sumtypes for D
Steven Schveighoffer
schveiguy at gmail.com
Tue Nov 29 05:00:42 UTC 2022
On 11/28/22 10:37 PM, Paul Backus wrote:
> 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))`).
This is not how I would solve it. I would solve it in the general case,
with a new syntax.
-Steve
More information about the Digitalmars-d
mailing list