logoalt Hacker News

jesse__yesterday at 8:36 PM1 replyview on HN

Okay .. so, riddle me this Batman.

If I have an untagged union in <language_of_your_choice>, and I'm iterating over an array of elements of type `Foo|Bar|Baz`, and I have to do a dynamic cast before accessing the element (runtime typecheck) .. I believe that must actually be a tagged union under the hood, whether or not you call it a tagged union or not... right? ie. How would the program possibly know at runtime what the type of a heterogeneous set of elements is without a tag value to tell it?


Replies

cubefoxtoday at 7:39 AM

That sounds plausible. Just like functional programming languages are imperative under the hood. It's all magic as far as I'm concerned.