Re: in/out contracts on prototypes

2018-05-17 Thread Kagamin via Digitalmars-d
On Wednesday, 16 May 2018 at 19:16:11 UTC, Manu wrote: I'm wondering if it should also be possible to apply in/out contracts to function prototypes? Contracts should be checked by the caller, yes, and the idea regularly pops up here, I though there's an issue for this, but can't find

Re: in/out contracts on prototypes

2018-05-16 Thread Zach Tollen via Digitalmars-d
On Wednesday, 16 May 2018 at 19:16:11 UTC, Manu wrote: I'm wondering if it should also be possible to apply in/out contracts to function prototypes? This came up when DIP1009 (improve contract syntax) was accepted. Relevant thread: https://forum.dlang.org/post/mailman.2332.1523425401.3374

Re: in/out contracts on prototypes

2018-05-16 Thread Jonathan M Davis via Digitalmars-d
imisations. > > > > > > I often call to extern C/C++ code, or even to D code built in a static > > > lib with a .di as interface. > > > Sadly, in/out contracts can not be used and offer no advantage in > > > these cases, because calls are

Re: in/out contracts on prototypes

2018-05-16 Thread Manu via Digitalmars-d
> > lib with a .di as interface. > > Sadly, in/out contracts can not be used and offer no advantage in > > these cases, because calls are made via function prototypes. > > > > I'm wondering if it should also be possible to apply in/out contracts > > to func

Re: in/out contracts on prototypes

2018-05-16 Thread Jonathan M Davis via Digitalmars-d
prototypes. > > I'm wondering if it should also be possible to apply in/out contracts > to function prototypes? > They are usually evaluated in the entry/exit blocks when compiling > functions, but when applied to prototypes, they would rather need to > be evaluated immediate

in/out contracts on prototypes

2018-05-16 Thread Manu via Digitalmars-d
++ code, or even to D code built in a static lib with a .di as interface. Sadly, in/out contracts can not be used and offer no advantage in these cases, because calls are made via function prototypes. I'm wondering if it should also be possible to apply in/out contracts to function prototypes