top | item 35492145

(no title)

nobody0 | 2 years ago

I wonder why Go doesn't have algebaric data types, it could solve a lot of issues, and make code a lot easier to write.

discuss

order

eru|2 years ago

My speculation: the authors didn't know / understand algebraic data types.

Also, to make algebraic data types useful, you really want parametric polymorphism. But yet again, the others of Go weren't familiar with this. The only vaguely related technique they knew about were C++ templates, and they (reasonably!) decided that they didn't want C++ template hell in their language.

That last part about templates is the least speculative of the bunch: I read some of the discussion they had about generics, and they explicitly mentioned templates (and how complicated they are) and pretty much mentioned nothing else for how to design or implement generics.

Go recently got some generics, partially thanks to some help from Phil Wadler who's otherwise more known for his work in functional programming.

wwalexander|2 years ago

I think Wadler also helped out on Java generics.

pjmlp|2 years ago

Unfortunately for the same reason it lacks many other modern features introduced by CLU and Standard ML in the mid-70's, language designers don't want to overburn Go developers with PhD level concepts.

mseepgood|2 years ago

Sounds like a good design guideline, so I wouldn't call it unfortunate.

Patrickmi|2 years ago

The design philosophy is what makes a programming language, any language maintainers could one day decide to have any of these, when you begin to understand “why this is language existed” you begin to understand its purpose

bsaul|2 years ago

That’s also my question. ADT seems really to fit well with the no-class no-inheritance design that go took. I don’t see how it would affect the language in any major way. But then, i’m not an expert.