title: Algebraic data types outside of functional languages?
body: <p>Which languages that are not solely functional have algebraic data
  types (or something similar) and pattern matching? I'm also interested in multi-paradigm languages - I know that Ocaml and F# are ML dialects with OO added, so they inherit the algebraic data types from ML.</p>
  
  <p>They can be kind-of emulated using <code>enum</code>s and <code>union</code>s (as in C, C++, ...more?), but this soon gets cumbersome and ugly, and the compiler can't warn you if you forget a case in your pattern matching or (much more propable, and much more dangerous) when accessing the union "in wrong ways", i.e. you ask for a field of a <code>Left</code> value when it's actually a <code>Right</code> value (what you get then is a meaningless reinterpretation of the bits that happen to be there).</p>
  
  <p>I've heard that <a href="http://www.gnu-pascal.de/gpc/Variant-Records.html" rel="nofollow noreferrer">Pascal has something like tagged unions</a> and the <a href="http://en.wikipedia.org/wiki/Cyclone_%28programming_language%29" rel="nofollow noreferrer">Cyclone language</a> supports tagged unions, too. Wikipedia also mentions Ada and Algol. Any other languages?</p>
  
  <p>(In case you never heard of algebraic data types, you can read <a href="https://stackoverflow.com/a/2502787">an Answer to "What is 'Pattern Matching' in functional languages?"</a> for an excellent introduction).</p>