std.unittests/exception Update and Vote [Please Vote]

Jonathan M Davis jmdavisProg at gmx.com
Mon Feb 7 03:47:46 PST 2011


On Monday 07 February 2011 03:36:33 Jim wrote:
> Not that I have a say in this matter, but although I think the code is
> excellent in technical merits, is not a central part of the problem it
> aims to mend actually an insufficiency in druntime?
> 
> I'd rather see the regular, language provided assert() fulfilling the needs
> as the assertion mechanism. Why would it otherwise be there? It would be
> like a language feature that nobody uses because it isn't good enough.. :/

That's part of what's up in the air. However,

1. assertPred does more than assert will ever do, no matter how much it's 
improved - though the likely _main_ usages of assertPred (such as 
assertPred!"=="(a, b) instead of assert(a == b)) may end up fixed in assert. Stuff 
like assertPred!"opCmp", assertPred!"-", and assertPred!"+=" won't ever be in 
assert, because they do more than just improve the error message on failure. 
It's pretty much just the versions which take a comparison operator and a 
general predicate which could be replaced by an improved assert.

2. Even if it is certain that assert will be improved, and even if it is certain 
that we don't want assertPred in std.exception in the long run, we still may 
want it in std.exception until assert _does_ get improved.

3. Some people may just assertPred regardless of what happens with assert.

So, yes. It would be great if assert were improved. But it's not clear that it 
will be, and even if it _does_ happen that doesn't necessarily mean that we 
don't want assertPred in Phobos.

- Jonathan M Davis


More information about the Digitalmars-d mailing list