On Thursday, 31 July 2014 at 13:10:58 UTC, Kagamin wrote:
On Thursday, 31 July 2014 at 06:57:15 UTC, Walter Bright wrote:
For LinearCongruentialEngine() and initialize(), passing
invalid arguments are programming bugs, and so they should be
asserting.
Isn't phobos compiled in release mode? And since those asserts
are never compiled, what purpose do they serve?
The whole type is templated, so the assertions will be compiled
in based on whether the user's code is compiled with -released or
not. But it is true that in any non-templated Phobos code,
assertions are only good for checking Phobos during its unit
tests if Phobos is compiled in release mode. IIRC though, there's
a -defaultlib switch (or something close to that) which allows
you to tell the compiler to use a different version of Phobos, so
you can tell it to use a non-release build of Phobos, but I don't
remember if we provide such a build with the released compiler or
not. Regardless, most code probably won't use it, so while it's a
nice idea and useful for those who put in the effort to use it,
it's definitely true that most code won't benefit from it,
seriously reducing the value of any assertions in non-templated
Phobos code which are intended to check user code rather than
Phobos itself.
- Jonathan M Davis