Dicebot on leaving D: It is anarchy driven development in all its glory.

aliak something at something.com
Tue Aug 28 18:44:37 UTC 2018


On Tuesday, 28 August 2018 at 17:53:36 UTC, H. S. Teoh wrote:
> On Tue, Aug 28, 2018 at 10:20:06AM -0700, Manu via
>> D has no way to express head-const, and it turns out it's a 
>> tremendously useful concept.
>
> I can live without head-const... but what *really* makes const 
> painful for me is the lack of head-mutable. I.e., given a const 
> container (which implies const objects), there is no universal 
> way to obtain a mutable reference to said const objects, unless 
> you tread into UB territory by forcefully casting it away.  
> This makes const so limited in applicability that, for the most 
> part, I've given up using const at all, in spite of having 
> tried quite hard to use it as much as possible for years.

Simen's opHeadMutable [0] was pretty good solution to this const 
range stuff, but for some reason (not specified by anyone in the 
thread) it didn't seem to catch on :/

[0] 
https://forum.dlang.org/post/zsaqtmvqmfkzhrmrmrju@forum.dlang.org




More information about the Digitalmars-d mailing list