Hacker News new | ask | show | jobs
by pufuwozu 5069 days ago
You're comparing ad-hoc polymorphism with subtype polymorphism. Doing so will lead you to the expression problem:

http://en.wikipedia.org/wiki/Expression_problem

Anyway, there's been quite a few proposals to add extensible records to Haskell, which would allow row polymorphism, similar to what you just showed in OCaml:

http://hackage.haskell.org/trac/ghc/wiki/ExtensibleRecords

Too bad that it has gone nowhere in a long time.

1 comments

> You're comparing ad-hoc polymorphism with subtype polymorphism.

No, I'm comparing structural typing, which is what Go implements, to nominative typing.

But that may very well be due to me having stayed in context of an other sub-thread where this was the subject, and using that as a filter for the current one.