Article: Why Const Sucks

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 6 18:31:39 UTC 2018


On 3/6/18 10:39 AM, Jonathan M Davis wrote:

> Yeah. If you're dealing with generic code rather than a specific range type
> that you know is implicitly saved when copied, you have to use save so often
> that it's painful, and almost no one does it. e.g.
> 
> equal(lhs.save, rhs.save)
> 
> or
> 
> immutable result = range.save.startsWith(needle.save);

Yep. The most frustrating thing about .save to me is that .save is 
nearly always implemented as:

auto save() { return this; }

This just screams "I really meant just copying".

-Steve


More information about the Digitalmars-d-announce mailing list