4 ms·
They want to implement discriminated unions on the heap. I'm excited for the code clarity, but it falls very short of the performance concern raised by an ances
by zamalek 5y ago
They want to implement discriminated unions on the heap. I'm excited for the code clarity, but it falls very short of the performance concern raised by an ancestor comment. That's the OOP trade-off.
We're also stuck with structured exception handling, so we'll have none of that Rust Result<T>, or Go tuple, goodness.
- phillipcarter 5y agoC# has tuples that are stack allocated
- Smaug123 5y agoF# allows you to put DUs on the stack, with `[<Stack>]`, for what it's worth.
- Smaug123 5y ago(By this I meant `[<Struct>]`, of course.)
- DeathArrow 5y ago>They want to implement discriminated unions on the heap. I'm excited for the code clarity, but it falls very short of the performance concern raised by an ancestor comment. That's the OOP trade-off. That isn't also the case with Haskell, OCaml and F#? IMO, if you care about performance you go procedural and watch how your data is aligned and how many allocations you do. Functional programming kind of requires to use immutable data structures, so you end up making copies and that will impact performance. I don't think you can have both highly performant and expressive code.