D3 sumtype api

monkyyy crazymonkyyy at gmail.com
Thu Feb 27 23:14:09 UTC 2025


Nullable and sumtype are fundamentally related and should just 
share code

I view community api as important, that everyone is vaguely on 
the same page that ranges have "front, popFront, empty" means 
code just werks to some degree

I suggest the following as a starting point for any sumtype 
related api

```
get!int: assume the value is in the Nth state, cast it into that 
value
classify: returns an int for the current state
classmax: the max+1 of what classify returns( to call switch over 
a static foreach)
iserror!int: returns if that sumtype is errory, 
nullable.iserror!1 is true, either.iserror!1 false
```

To get some degree of benefits for the range api to extend to any 
future sumtype related code.


More information about the dip.ideas mailing list