D3 sumtype api

monkyyy crazymonkyyy at gmail.com
Fri Feb 28 01:18:15 UTC 2025


On Friday, 28 February 2025 at 01:06:01 UTC, Paul Backus wrote:
> On Friday, 28 February 2025 at 00:46:13 UTC, monkyyy wrote:
>> If I read that right you were doing it get!int but now its 
>> breaking;
>
> You read wrong.

https://github.com/dlang/phobos/pull/10650/commits/fe64ac592b03037b99e5ea201c0170af2281ea4b#

you had `ref get(size_t tid)()` and now its `ref 
getByIndex(size_t tid)()`

my version of match is

```d
template match(F...){
auto match(T)(T t){
	switch(t.classify){
		static foreach(I;0..T.classmax){
			case I: return F[I](t.get!I);
		}
	default: assert(0);
}}}
```

If naively some future d3 user had your modified sumtype and 
called my match, it would break(in an additional way); but your 
modifying d2 code so... Unfortunate but likely not reverent there 
is zero chance d2 will make any level of progress unifying 
sumtype and nullable; even if I expect some attempt to try for d3.


More information about the dip.ideas mailing list