digitalmars.D - contracts for external functions?
- Trass3r (9/9) Aug 23 2010 The Matlab C headers provide some kind of hand-crafted contracts by
- bearophile (4/7) Aug 23 2010 A nice idea to remember (regardless the syntax used to do it).
- Trass3r (1/5) Aug 23 2010 At least that's the interface contracts syntax (wonder why there's no ';...
- Trass3r (1/4) Aug 24 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4720
The Matlab C headers provide some kind of hand-crafted contracts by defining extra functions with suffix "_d" that check all the arguments and then detouring the calls to the original functions via the preprocessor (#define foo foo_d) Of course I could do it the same way, but wouldn't it be better to add this case to D's contract programming similar to interface contracts? extern(C) int foo(int i) in { assert(i > 7); } out (result) { assert(result & 1); }
Aug 23 2010
Trass3r:extern(C) int foo(int i) in { assert(i > 7); } out (result) { assert(result & 1); }A nice idea to remember (regardless the syntax used to do it). Bye, bearophile
Aug 23 2010
At least that's the interface contracts syntax (wonder why there's no ';')extern(C) int foo(int i) in { assert(i > 7); } out (result) { assert(result & 1); }A nice idea to remember (regardless the syntax used to do it).
Aug 23 2010
extern(C) int foo(int i) in { assert(i > 7); } out (result) { assert(result & 1); }http://d.puremagic.com/issues/show_bug.cgi?id=4720
Aug 24 2010