Contracts in library code

Sean Kelly sean at invisibleduck.org
Tue Dec 28 07:18:41 PST 2010


bearophile Wrote:

> To solve the problem with Contracts in library code (like in Phobos or in user-created libraries) is it possible to let DMD (asking it with a compiler switch, I presume) compile and put inside the library two versions of each function/method, with differently mangled names?
> 
> So when you import and use compiled functions from Phobos the linker uses the version of the function with or without Contract assertions according to the compilation switches (like -release) you have used.

I'd be fine with simply shipping two libs.  DMD already has -defaultlib and -debuglib, the flags really just need to be -defaultlib and -releaselib.  Shipping a separate lib for debug app builds isn't really useful anyway.  -release also has to be the worst flag name ever.


More information about the Digitalmars-d mailing list