bettersum (v0.7.0): mixin-based sumtypes

monkyyy crazymonkyyy at gmail.com
Wed Oct 7 04:13:35 UTC 2026


On Wednesday, 7 October 2026 at 02:24:40 UTC, DanielG wrote:
> Dub package:
> https://code.dlang.org/packages/bettersum
>
> GitHub repo:
> https://github.com/dewf/bettersum
>
> Check the README for usage.
>
> I realized a few weeks back that I could probably get 90% of 
> what I want (minus legit pattern-matching) from sumtypes just 
> by writing a mixin. So, here we are.
>
> Feel free to suggest ideas for even more concise or useful 
> pattern-matching-like idioms. I did what I could with what I 
> know, which admittedly ain't much :)
>
> I need to return to a more important project for awhile, but I 
> hope to get this to a v1.0 release by the end of the year.
>
> Note: the first thing I want to fix in the near future, is the 
> error reporting (for parsing errors) - it will be off by a 
> token length, column-wise - and is very likely broken in other 
> ways. Plus I haven't tested the parser much, so don't expect it 
> to be robust against weirdness.
>
> Also I need to update the example to show how to use snake_case 
> instead (ew).
>
> We'll get there!

```
dtype.d
lexer.d
options.d
package.d
parsecommon.d
parser.d
renderer.d
tokenizer.d
typeparser.d
unit.d
util.d
```

I hope you vibe coded that, thats allot... its allot, allot
I think snar's is at 1.5k lines but allot of that is comments and 
verbose unit tests

If you want something more implict but grab the related data, 
theres got to a better template pattern then recreating a parser


More information about the Digitalmars-d-announce mailing list