[Issue 11080] assert(`string`) should be forbidden

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 23 05:46:54 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11080



--- Comment #26 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-09-23 05:46:52 PDT ---
(In reply to comment #24)
> I think his point was that enforce *could* be written to not accept string
> literals

Well yeah, so now that's yet another special case. Then you'll have a bunch of
Phobos functions working, others not working, and 3rd party libraries doing
their own thing.

I agree that assert("foo") is meaningless, but I think we should fix it by
disallowing implicit bool conversion from a string. Can you really tell at a
glance whether `if (getString())` checks for ".length != 0" or "!is null"? I
can't, and I always have to look up the specs to remind myself (not in my code,
I don't use this form of implicit bool check).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list