sumtypes for D
Paul Backus
snarwin at gmail.com
Tue Nov 29 03:37:39 UTC 2022
On Tuesday, 29 November 2022 at 03:03:37 UTC, Steven
Schveighoffer wrote:
>
> The problem is that there's no syntax to "tail-modify" a type
> other than a pointer or an array. This is the biggest problem
> with properly using const on ranges (it doesn't prevent using
> const containers, or prevent ranges to const data, it just
> prevents taking a range to a *mutable container* and iterating
> it via a const parameter).
>
> I think I've been bringing this problem up for 10 years. It
> would be a huge win to get it solved.
The thing is, we pretty much know what the solution is. In the
general case, solving this requires user-defined implicit
conversions, because in the general case only the user has the
knowledge necessary to establish the correspondence between a
templated type's *structure* (e.g., "the head-mutable version of
`const(Foo!T)`") and its *name* (e.g., `Foo!(const(T))`).
The problem is, that solution has been declared categorically off
the table, so we are stuck going in circles debating the merits
and shortcoming of various half-measures.
More information about the Digitalmars-d
mailing list