[phobos] std.array.ilength

Jonathan M Davis jmdavisProg at gmx.com
Thu Feb 17 18:35:50 PST 2011


On Thursday, February 17, 2011 18:08:15 David Simcha wrote:
>  Ok, I've come to the conclusion that we're never going to reach a
> consensus, so I'll lay a card on the table.  I never really liked the
> change that makes implicit narrowing conversions illegal (or most of the
> other increased strictness that D has acquired recently) in the first
> place.  This and many other things used to be a warning and to me that's
> exactly what they should be.  Warnings are for things that are
> unambiguous, have a decent probability of not being bugs, but also have a
> decent probability of being bugs.  Errors are for things that are
> ambiguous or are almost certainly bugs, or for when you explicitly asked
> for extra checking, for example by using const.  You might want the
> compiler to complain about narrowing conversions when you're trying to
> clean up the code, hunt for latent bugs that would only show up in
> production, and get to the "make it right" stage, or trying to figure out
> why it doesn't work.  Most narrowing conversions, though, are innocent and
> it's really annoying for the compiler to act like they need to be
> addressed right now, when you're still in the "make it work" stage or just
> writing some quick and dirty piece of code that only needs to run once.

Hmm. I'm definitely of the opinion that no responsible programmer will leave 
warnings in their program in the long run (though they may leave them while 
they're in the process of editing code), so I tend to not like the fact that 
warnings even exist. On some level, they're pointless because you shouldn't be 
leaving them in there any more than you leave errors in there. And too many 
programmers are willing to just leave them in there. On the other hand, 
sometimes it can be nice to leave a warning alone for a few minutes while you 
work on other issues. So, I'm generally divided on whether warnings should even 
exist. Walter is certainly against them.

I wouldn't be entirely opposed to narrowing conversions becoming a warning, but 
if that means that people start just leaving them in their code and not fixing 
the warnings, then that's _bad_. Narrowing conversions should _not_ just be left 
implicit in the code.

- Jonathan M Davis


More information about the phobos mailing list