Hacker News new | ask | show | jobs
by baby 1356 days ago
I think if Golang would have been invented a couple of years later it def would have had sum types. But then, Rust probably wouldn’t have had its insane tooling that is most likely inspired by golang
3 comments

It’s not like sum types weren’t known a decade before that. Or generics. They just didn’t care.
These issues were also brought up immediately when the language was first shown, alongside nulls, tuples, error handling, etc…
what imperative language had them?
I doubt it. It seems quite apparent that Thompson just wanted to take another stab at creating the next generation in the B -> NB (New B) -> C -> Go family tree. It would have likely been named D if the name wasn't already taken.

Pike slapped his Newsqueak's CSP paradigm on top and the rest is history.

Go is basically an AOT compiled version of Limbo with the method syntax and UNSAFE package from Oberon-2, and they stopped there.
> I think if Golang would have been invented a couple of years later it def would have had sum types.

How to combine sum types and a precise garbage collector?

They're not mutually exclusive. Scala and Haskell had them for a long time now, and Java got them relatively recently.
How can a precise garbage collector work when it does not know if a value is or is not a pointer?