On Wednesday, 24 January 2018 at 11:21:59 UTC, Nick Treleaven wrote:
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

Nice. I guess HeadMutable should use Rebindable in those cases, if you get this merged. It addresses a somewhat orthogonal issue though. We need to be able to call mutating methods on the resulting value, e.g. popFront(), without mutating aliased values. For that to work, the type must be able to specify how to make a head-mutable version of itself. Rebindable cannot offer this kind of access (and shouldn't).

--
  Simen

Reply via email to