logoalt Hacker News

celeriestoday at 2:29 PM1 replyview on HN

Yes, but that's just the default behavior. You can implement your own non-boxing version for performance critical applications.


Replies

algorithmsRcooltoday at 5:24 PM

Why on earth did they decide boxing by default was a sensible design decision...

We have been pushing toward higher performance for years and this is a performance pitfall for unions would are often thought of as being lighter weight than inheritance hierarchies.

F# just stores a field-per-case, with the optimization that cases with the same type are unified which is still type safe.

show 3 replies