[phobos] A few minor features

Jacob Carlborg doob at me.com
Sun Oct 31 09:02:46 PDT 2010


On 31 okt 2010, at 16:54, David Simcha 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.

I think it's completely wrong that enforce throws Exception, it should throw an exception of its own type, like EnforceException.

> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

-- 
/Jacob Carlborg



More information about the phobos mailing list