Second draft: Sum Type by Struct

Nick Treleaven nick at geany.org
Wed Sep 9 16:06:51 UTC 2026


On Wednesday, 9 September 2026 at 10:32:59 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> All the cases you showed as suggestions are still expressions. 
> We cannot go from an expression to a statement in the AST. This 
> can be fixed, its just a lot of work, and outside the scope of 
> this DIP and implementation.

I agree my suggestion of *MatchExpInitializer* might not be 
possible, as *ExpInitializer* can be a nested expression.

I was trying to say that one solution (which I think supports the 
core use cases better) may be to have special AST *statements* 
for these:

> T v = e.match { ... };
> return e.match { ... };

I.e. no expression is parsed for `e.match {...}` in the above 2 
lines.

However I know for this DIP you wanted to be able to chain match 
expressions. I agree that could be useful, but I don't think it 
is a core use case. I would sacrifice the ability to do that in 
order to have full use of statements in the match arms.


More information about the dip.development mailing list