sumtypes for D

Steven Schveighoffer schveiguy at gmail.com
Tue Nov 29 03:03:37 UTC 2022


On 11/28/22 9:42 PM, deadalnix wrote:
> On Tuesday, 29 November 2022 at 01:27:32 UTC, Walter Bright wrote:
>> It would be nice if you enumerated those fundamental problems. I don't 
>> know what they are.
> 
> I have done so numerous times. Every single god damn time you answer the 
> same thing.
> 
> IT IS NOT POSSIBLE TO WRITE A COLLECTION IN D THAT BEHAVE PROPERLY AS 
> PER THE TYPE SYSTEM'S RULES.

This is pretty harsh for the single problem you bring up, which I agree 
would be nice to fix, but absolutely is not a fundamental problem for 
having containers in D.

Yes, if you have the same problem over and over again, it's frustrating 
to have it continually ignored or dismissed. But it's also not possible 
to always search this forums for all the times it was brought up. Half 
the time, I don't remember conversations that *I have had* on these 
forums, and sometimes I sheepishly discover that I had the opposite 
opinion some years ago.

So please let's discuss this problem in a productive way. 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.

-Steve


More information about the Digitalmars-d mailing list