Improving assert-printing in DMD

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 29 14:18:54 PDT 2015


On Tue, Sep 29, 2015 at 09:13:55PM +0000, John Colvin via Digitalmars-d wrote:
> On Tuesday, 29 September 2015 at 21:02:42 UTC, Nordlöw wrote:
[...]
> >2. Is it possible to from within DMD generate expressions that do
> >
> >`import std.stdio : write`
> >
> >and then calls write on the `lhs` and `rsh`...or this a completely
> >wrong approach to solving this problem?
> 
> Someone will write something like this:
> 
> assert(plainPassword == plainPassword.toLower());
> 
> and plaintext passwords will end up in stderr.

That's an instance of assert abuse, and we probably don't have to be
responsible for it.  Such checking belongs in enforce, or an explicit
check with an exception throw, NOT an assert.


T

-- 
If blunt statements had a point, they wouldn't be blunt...


More information about the Digitalmars-d mailing list