Article: Why Const Sucks
Nick Sabalausky (Abscissa)
SeeWebsiteToContactMe at semitwist.com
Tue Mar 6 03:21:47 UTC 2018
On 03/05/2018 12:38 PM, H. S. Teoh wrote:
>
> This broke the by-value
> assumption inherent in much of Phobos code,
Wait, seriously? Phobos frequently passes ranges by value? I sincerely
hope that's only true for class-based ranges and forward-ranges (and
more specifically, only forward ranges where copying the range and
calling .save are designed to do the exact same thing). Otherwise,
that's really, *REALLY* bad since non-forward ranges *by definition*
cannot be duplicated.
Honestly, I think this is the one big flaw in the otherwise really nice
design of ranges.
The definition of "what is a forward/non-forward range" for struct-based
ranges should have been "is this() @disabled (non-forward range), or is
this() enabled *and* does the same thing as .save (forward range)?"
Without that, this is a serious hole in non-forward ranges.
More information about the Digitalmars-d-announce
mailing list