5 ms·
Java had become the industry's workhorse also without generics, that were included only in Java 5, 8 years after Java 1.0. C++ had it for ages by that time, but
by nine_k 8y ago
Java had become the industry's workhorse also without generics, that were included only in Java 5, 8 years after Java 1.0. C++ had it for ages by that time, but it did not help its adoption too much (if not the other way around).
Go's very lack of expressive power is what helps make it an enterprise language. It's simple enough and limiting enough so that a non-brilliant developer has little trouble picking it up, and is unlikely to run into a complicated corner case. As statistics inevitably have it, half the developers are below median level, by definition.
The really smart stuff in Go, like goroutines scheduling or lightning-fast GC, is all under the hood, and you don't get to touch it, and don't have to.
You can see the same pattern in other wildly successful languages of the past, such as Fortran, Cobol, Visual Basic, or PHP.
Having one of the largest IT corporations backing the language and actively using it does help, too. But I would not exaggerate this factor: Python got to the top without a comparable corporate support from its creators.
- smnplk 8y ago>> Python got to the top without a comparable corporate support from its creators.<< Yeah, but Google did a lot for python adoption.
- hyeomans 8y agoTalking about coroutines, how do you do a synonym of async/await + Promise.all + cancellation token? In a microservice world, I habe to send a request to 6 microservices and I want to do them concurrently not sequentially
- omani 8y agouse zeromq
- nine_k 8y agoSpin several goroutines, do a `select` on them. It's right in the Tour of Go. Cancellation tokens are harder, though.
- tonyarkles 8y agoIt’s been a while since I’ve been writing Go, but wasn’t that nominally what the Context objects were supposed to be for? I think they were introduced a bit late in the game, but APIs that supported them handled cancellation well (if I’m remembering right)
- owaislone 8y agoContext would be passed to each go-routines for cancellation but the pattern would be the same as OP's suggestion. I'd say a set of go-routines and a sync.WaitGroup would probably be a better pattern for this use case. Routines + select is more useful for listening on incoming data than concurrently sending out bytes.
- booleandilemma 8y agoJava had become the industry's workhorse also without generics... Yeah but now that we have generics the bar has been raised right? I’m not giving generics up, that’s for sure.
- copperx 8y agoJava had the Object superclass, and that's how generic methods and classes were written before version 5. Is there a Go equivalent of Object?
- adamlett 8y agoYes. The empty interface.
- geodel 8y agoWell of course you don't need to. Individual/independent developers would use what they deem fit. It is corporate developers who will receive mandate to use a particular language or technology. For example a large company where I work, it is mostly Java shop. However the new telemetry/tooling group has now mandated to use Go. So about 40+ devs are working in Go. Nobody asked their opinion about Go vs Java or Generics , Sum types, exception vs errors and so on. Same devs would have used Weblogic/Websphere or whatever if asked. Developers in this categories are not going to say "LOL J2EE" or "LOL Go". They will do whatever being asked and collect paycheck in return. If they chose to be independent voice, they are going to be asked to leave and make way for devs who comply.