News for hackers. Stuff that matters.
Re:Generics aren't ready for Go by kasey_junk on Monday February 18, 2019 @09:28AM (#19190747)
First go does have generics. It just doesn’t have user defined generics.

But to answer your question go has really mediocre support for a wide variety of problems. Some that burn me a lot is support for future/promises and support for modern lock free algorithms.

So you end up either writing non-optimal replacements, losing type safety or in some case code generation is used.

Re:Generics aren't ready for Go by emersion on Monday February 18, 2019 @09:32AM (#19190776)
>Some that burn me a lot is support for future/promises

This doesn't make sense in Go. Nothing is asynchronous in Go, everything is blocking. You use goroutines to execute multiple tasks at the same time. That's a big part of what makes Go simple: it's a lot easier to understand sequential code than spaghetti callbacks and promises (it's somewhat similar to async/await in the JavaScript world).

Re:Generics aren't ready for Go by kasey_junk on Monday February 18, 2019 @09:38AM (#19190817)
Yet open up nearly any large golang codebase and you’ll find a channel being used to return a single answer response in the future.
Re:Generics aren't ready for Go by emersion on Monday February 18, 2019 @09:43AM (#19190865)
What's wrong with that? Go has channels thus it doesn't need futures/promises.
Re:Generics aren't ready for Go by kasey_junk on Monday February 18, 2019 @09:48AM (#19190926)
Some problems are more simply modeled as futures/promises than csp.

Go’s unsophisticated type system makes it difficult to write a good standard generic data structure library such as a future/promise library.

That leads to people either writing a poor replacement, not using that style, or losing type safety. This is precisely what you would predict upon learning golang doesn’t have user defined genetics & ive had it bite me more than once in real projects.

Re:Generics aren't ready for Go by heavenlyblue on Monday February 18, 2019 @09:38AM (#19190821)
Yeah, and that's why Go code is a spaghetti of communicating via channels, rather than callbacks.
Re:Generics aren't ready for Go by johnydepp on Monday February 18, 2019 @10:11AM (#19191166)
Go channels are very handy and magnitude of less spaghetti than futures. And goroutines have good performance.

I think people are used to futures etc, that's why the new concept feels strange.

I think the goroutines and channels are the biggest features which compensates for generics.

Re:Generics aren't ready for Go by emersion on Monday February 18, 2019 @09:44AM (#19190876)
Each code in each goroutine is synchronous. That's what makes it simpler than callbacks.
Re:Generics aren't ready for Go by weberc2 on Monday February 18, 2019 @09:54AM (#19190990)
Callbacks are prolific in Go; not sure where you're getting this from...
Re:Generics aren't ready for Go by j16sdiz on Monday February 18, 2019 @09:36AM (#19190800)
use channel + goroutinue for that.

Goroutinue are very light weight. Zero size channel works like promise

Re:Generics aren't ready for Go by apta on Monday February 18, 2019 @11:48AM (#19191986)
Which makes code even more messy than just using Futures.