[phobos] A few minor features
spir
denis.spir at gmail.com
Sun Oct 31 14:32:46 PDT 2010
On Sun, 31 Oct 2010 11:54:18 -0400
David Simcha <dsimcha at gmail.com> wrote:
> 3. An alwaysAssert() function that stays on in release mode but is
> otherwise equivalent to assert(). I had been using enforce() for this,
> but I don't like that anymore because it throws Exception, not
> AssertError by default. This means that if I write catch(Exception), I
> could accidentally be catching what is effectively an assertion
> failure. Since assert() is supposed to be terse to encourage the
> programmer to use it liberally, explicitly passing AssertError to
> enforce() doesn't cut it. Mostly what I need here is a better/terser
> name than alwaysAssert(). Given the nature of this feature, I'd say
> terseness actually beats explicitness. The best I've come up w/ so far
> is rassert() for release assert.
Hello,
[New to D. Mainly subscribed to the list as a help in getting to know the lib quicklier.]
"Release asserts" seem to me nearly a necessary feature. (Precisely, bugs have the unpleasant habit of hiding during test phases.]
As for names:
predict(n != 0) playing with "predicate"
exclude(n == 0) reversing the assertion
The latter looks good to me in the sense contract.
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
More information about the phobos
mailing list