Article: Why Const Sucks

Adam D. Ruppe destructionator at gmail.com
Tue Mar 6 15:23:52 UTC 2018


On Tuesday, 6 March 2018 at 03:21:47 UTC, Nick Sabalausky 
(Abscissa) wrote:
> Wait, seriously? Phobos frequently passes ranges by value?

You *should* pass most ranges by value, just like how you should 
rarely use `ref T[]` or `T[]*`. Ranges, like slices, are 
typically already small references to some other container.

Where Phobos effs it up is not follow its own rules on range.save 
in most cases... Jonathan talked about this at dconf IIRC in 2015.

> 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)?"

yeah.


More information about the Digitalmars-d-announce mailing list