Implementing tail-const in D

Nick Treleaven nick at geany.org
Wed Jan 24 11:21:59 UTC 2018


On Tuesday, 23 January 2018 at 09:36:03 UTC, Simen Kjærås wrote:
> Unqual is the standard way today to get a head-mutable version 
> of something. For dynamic arrays, static arrays, pointers and 
> value types, including structs without aliasing, thi works. For 
> AAs, classes, and structs with aliasing, Unqual is the wrong 
> tool, but it's the tool we have, so it's what we use.

I made an old PR for a Rebindable that works with const/immutable 
structs with aliasing:
https://github.com/dlang/phobos/pull/4363

I didn't have time to get it merged though. I didn't think about 
AAs, but we already have Rebindable for classes, and Rebindable 
could probably easily support the other types. Then we could swap 
those uses of Unqual for Rebindable.


More information about the Digitalmars-d mailing list