assume, assert, enforce, @safe

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 1 07:10:13 PDT 2014


On Friday, 1 August 2014 at 08:21:28 UTC, Kagamin wrote:
> On Thursday, 31 July 2014 at 21:29:59 UTC, Sean Kelly wrote:
>> So effectively, any factor occurring at runtime.  If I create a
>> library, it is acceptable to validate function parameters using
>> assert() because the user of that library knows what the 
>> library
>> expects and should write their code accordingly.  That's fair.
>
> He should, but what if he doesn't and the library is phobos or 
> druntime (which are compiled in release mode)? BTW, druntime 
> can't use enforce and doesn't verify its input.

Druntime uses contracts and asserts in places. Which are of 
course removed because we ship only a "release" build.  Once 
again, the worst naming for a compiler switch ever. What I really 
want is a way to ship release and non-release builds (ie. checked 
and unchecked) and have the proper one chosen at link time based 
on build flags. Basically toss the -defaultlib and -debuglib and 
replace it with -checkedlib and -uncheckedlib.


More information about the Digitalmars-d mailing list