sumtypes for D

deadalnix deadalnix at gmail.com
Tue Nov 29 02:42:57 UTC 2022


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.

Is that big enough? vector? Set? Map? Does any of it ring a bell? 
Even range code completely shits the best as long as you throw a 
const in there.

Type qualifier do not turtle down (Vector!int and 
Vector!const(int) are completely unrelated constructs), the top 
level qualifier need to be able to pop when things are passe by 
value, etc...

You know what these behavior are, there are the one of builtin 
slices. This is not random, this is the behavior that is needed 
for containers, range, and, for that matter, sum types.

Adding more stuff on top of broken foundations achieve only one 
goal: an increase complexity. Because none of these things are 
the actual bottleneck for anyone.

Would I want tuples, sum types and whatnot, assuming the core 
language was not full of bear traps? Yes. Absolutely. Let's talk 
about it when the bear trap situation is under control. Because 
none of this is useful.


More information about the Digitalmars-d mailing list