First Draft: Nominal Sum Types via `enum union` and `switch` Expressions
Meta
jared771 at gmail.com
Fri Sep 18 00:30:58 UTC 2026
On Thursday, 17 September 2026 at 12:24:56 UTC, Paul Backus wrote:
> On Tuesday, 15 September 2026 at 22:25:13 UTC, Meta wrote:
>> The compiler can lower a switch expression into a jump table,
>> instead of the nested lambda calls of the current library
>> solutions. Even if they're aggressively inlined, there's very
>> little chance they'll get optimized as well as a language
>> construct can be.
>
> I actually tested this a few years back. It turns out that,
> assuming it can inline the callbacks, the compiler can optimize
> `match` just as well as it can optimize a naked `switch`
> statement:
>
> https://pbackus.github.io/blog/beating-stdvisit-without-really-trying.html
Nice, I stand corrected.
More information about the dip.development
mailing list