Forbid dynamic arrays in boolean evaluation contexts
bearophile
bearophileHUGS at lycos.com
Mon Mar 25 07:09:32 PDT 2013
Peter Alexander:
> On Sunday, 24 March 2013 at 22:10:06 UTC, bearophile wrote:
>> So my proposal of Issue 4733 is to forbid (with the usual
>> warning/deprecation intermediate steps) the use of dynamic
>> arrays in a boolean context:
>
> Seems like a sensible idea. I've never really understood why
> null is acceptable as a slice anyway. It's not a class, so it
> shouldn't be allowed.
Maybe you are confusing issue 4733 with this other one:
http://d.puremagic.com/issues/show_bug.cgi?id=3889
Unlike Issue 4733, issue 3889 doesn't cause bugs, so it's less
important.
Here I am not asking to disallow null as a slice. I am asking to
disallow the implicit cast "dynamic array => bool". Because it's
a source of bugs and there are simple & more explicit ways to do
the same thing if you want to.
Bye,
bearophile
More information about the Digitalmars-d
mailing list