loading...

re: What the heck is polymorphism? VIEW POST

FULL DISCUSSION
 
 

Not quite. It's implemented as a tagged union, but the power comes from building a full algebra that makes type composition trivial and very easy to reason about (thus the phrase "algebraic data type"). Their history goes back to the 1970's, so they're not much younger than C and they're older than object oriented programming.

 

"Their history goes back to the 1970's, so they're [...] older than object oriented programming."

Errr... Object oriented programming dates back to Simula 67, released in 1967 (or even further -- you can do OOP without language support, as long as your language supports indirect function calls, and there are anecdotal stories of people creating objects in assembly language all the way back to the 50s).

 

Call what a union? I don't see any way a C union could be considered polymorphic. It is basically just a convenience for casting.

Or do you mean that a union is as far as you can bring C's type system?

code of conduct - report abuse