6 ms·
> To me it feels very similar to an interface (trait) implemented by a bunch of classes (structs) Then you might not fully grok sum types yet. > From my persp
by beltsazar 2y ago
> To me it feels very similar to an interface (trait) implemented by a bunch of classes (structs)
Then you might not fully grok sum types yet.
> From my perspective a discriminant vs a vtable pointer is a boring implementation detail the compiler should just figure out for me based on what would be more optimal in a given situation.
Disagree. It's a design choice that should be decided by the programmers. There's a tradeoff—choosing which should be easier: adding a new variant or adding a new function/method. It's called the Expression Problem: https://wiki.c2.com/?ExpressionProblem https://wiki.c2.com/?ExpressionProblem