Why is this allowed
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Jun 30 17:45:39 UTC 2020
On Tue, Jun 30, 2020 at 04:50:07PM +0000, Adam D. Ruppe via Digitalmars-d-learn wrote:
> On Tuesday, 30 June 2020 at 16:41:50 UTC, JN wrote:
> > I like my code to be explicit, even at a cost of some extra typing,
> > rather than get bitten by some unexpected implicit behavior.
>
> I agree, I think ALL implicit slicing of static arrays are problematic
> and should be removed. If you want to set it all or slice it for any
> other reason, just put on the [].
We've known this for at least 4 years, yet nothing has been done about
it. :-(
https://issues.dlang.org/show_bug.cgi?id=15932
The problem isn't just safety, which is partly addressed by dip1000, but
also mistakes of the kind the OP posted. Basically, it's a misfeature
with many ill side-effects all in the questionable name of convenience.
It's time we got rid of it.
T
--
Truth, Sir, is a cow which will give [skeptics] no more milk, and so they are gone to milk the bull. -- Sam. Johnson
More information about the Digitalmars-d-learn
mailing list