logoalt Hacker News

SideburnsOfDoomyesterday at 12:34 PM2 repliesview on HN

It's very unclear which you mean by that.

To me that "compiler-verified" maps to "sealed", not "on the fly". Probably.

Their example is:

public union Pet(Cat, Dog, Bird);

Pet pet = new Cat("Whiskers");

- the union type is declared upfront, as is usually the case in c#. And the types that it contains are a fixed set in that declaration. Meaning "sealed" ?


Replies

pjc50yesterday at 12:42 PM

OK then, what is the opposite of this, the adhoc union?

show 2 replies
orthoxeroxyesterday at 4:16 PM

I mean that Cat, Dog and Bird don't have to inherit from the union, you can declare a union of completely random types, as opposed to saying "Animal has three subtypes, no more, no less", which is what F# does more or less.