News for hackers. Stuff that matters.
Re:Go 1.18 by ed25519FUUU on Tuesday March 15, 2022 @03:09PM (#30689758)
Plenty of great functional alternatives to Go.
Re:Go 1.18 by cube2222 on Tuesday March 15, 2022 @03:15PM (#30689879)
Definitely! I'd be worried though that functional developers coming to Go (for whatever reason) would try to write Go functionally. That will fortunately be very hard thanks to this limitation.

Nothing specific against functional programming per-se, but as you said, Go's not the language for it.

Re:Go 1.18 by zinclozenge on Tuesday March 15, 2022 @04:21PM (#30691029)
None with the same performance characteristics, ease of use, and ecosystem size. I'm reasonably competent with Rust, but sometimes I don't want to bash my head against the borrow checker or litter my code with copy/clone. Go hits a nice sweet spot, my main quibbles are that there's no native iterators/comprehensions or sum types with compiler checked exhaustive matching. With generics we can get libraries that allow for more functional style programming, and golangci-lint has a linter for exhaustiveness.
Re:Go 1.18 by cardanome on Tuesday March 15, 2022 @06:24PM (#30692733)
Ocaml.

Insanely fast compiler. Great type system. Functional programming at its best but still relatively pragmatic and easy to mix in some imperative code if need be.

It is a bit more complicated than Go and the ecosystem is maybe a bit more patchy but other than you will have a good time.

Re:Go 1.18 by int_19h on Tuesday March 15, 2022 @10:11PM (#30694481)
Ocaml is not particularly fast, for a compiled language. Is Go really slower?
Re:Go 1.18 by feffe on Wednesday March 16, 2022 @04:03AM (#30696380)
The compiler is fast in that is compiles code quickly, just as Go and the execution speed of produced programs are similar to Go (depending on what abstractions you use).

It seems there are a bunch of languages in the fast but not quite as fast as C/C++ category: Java, C#, Go, OCaml, SBCL (Lisp), Haskell

Re:Go 1.18 by chakkepolja on Tuesday March 15, 2022 @11:37PM (#30695056)
(not GP)

>> fast compiler

But yeah everything is fast at runtime as well when you coming from JS and python.

Re:Go 1.18 by zinclozenge on Thursday March 17, 2022 @01:28PM (#30713675)
Believe me, i'd love to use ocaml but the ecosystem isn't just "a bit more patchy" compared to go, unfortunately.
Re:Go 1.18 by geodel on Wednesday March 16, 2022 @09:43AM (#30698714)
> and the ecosystem is maybe a bit more patchy..

Well that makes all the difference, if one is writing programs in professional capacity.

Re:Go 1.18 by SureshG on Tuesday March 15, 2022 @06:52PM (#30693006)
> None with the same performance characteristics,

Most JVM languages (Kotlin/Scala/Clojure) including Java :) In fact kotlin/java has better peak performance than Go. Main advantage for go is the reduced memory footprint.

Re:Go 1.18 by Thaxll on Tuesday March 15, 2022 @07:21PM (#30693254)
> In fact kotlin/java has better peak performance than Go.

Not really no.

Re:Go 1.18 by dgb23 on Wednesday March 16, 2022 @04:46AM (#30696597)
Sophisticated garbage collection and JIT have a very high ceiling. The CLR and the JVM are incredible technologies.
Re:Go 1.18 by ed25519FUUU on Thursday March 17, 2022 @11:55AM (#30712543)
The thing I hate about the JVM is that I'm always trying to tune it. So many options and nobs to turn. With Go I just run execute the program, no tuning necessary.
Re:Go 1.18 by jjtheblunt on Tuesday March 15, 2022 @07:41PM (#30693422)
> In fact kotlin/java has better peak performance than Go.

Says what benchmark?

Re:Go 1.18 by kitd on Wednesday March 16, 2022 @07:10AM (#30697399)
There are many benchmarks showing Java faster than Go. The trick is picking one that people agree is representative.

It shouldn't be surprising though. "Peak performance" doesn't include start-up time, and ignores memory. If you discount both those, there's no reason that JITted native code wouldn't be faster than a runtime that includes goroutine scheduling.

Re:Go 1.18 by jjtheblunt on Wednesday March 16, 2022 @04:12PM (#30703441)
unless goroutines aren't in use, which means the generated code probably matches what llvm and C would generate.
Re:Go 1.18 by kaba0 on Tuesday March 15, 2022 @06:10PM (#30692552)
Scala is pretty close to Go in terms of popularity and I would argue that it has a much bigger ecosystem due to the JVM. It is also pretty much a typed python in terms of ease of use, and the JVM has stellar performance — other than small running scripts, for many kind of workloads Java’s state of the art GC will have better throughput than Go’s.
Re:Go 1.18 by Thaxll on Tuesday March 15, 2022 @07:22PM (#30693266)
Scala is on its way to die actually, I worked couple of years with lot of services in Scala, they were all replaced by regular Java or C# over the years, Scala missed the train and it's more and more difficult to find people that want to work with that language.

It's a stagnant language that will not get more popular, it peaked.

Re:Go 1.18 by bjt on Wednesday March 16, 2022 @02:23AM (#30695892)
> It's a stagnant language that will not get more popular, it peaked.

I can't speak to whether it's "stagnant", but at least as a percentage of questions on Stack Overflow, the claim that "it peaked" checks out. The peak for Scala was late 2016. Go surpassed it in 2020.

https://insights.stackoverflow.com/trends?tags=scala%2Cgo

Re:Go 1.18 by geodel on Wednesday March 16, 2022 @09:27AM (#30698520)
You are right. Going by Google trends Scala is not only less popular then Go it is further going down when compared to Go [1]

1. https://trends.google.com/trends/explore?date=today%205-y&ge...

Re:Go 1.18 by kaba0 on Tuesday March 15, 2022 @07:38PM (#30693394)
It just got a huge revamp with Scala 3, please do check it out if you hadn’t yet - it fixes some pain points while has many many exciting features, eg. can be null-safe with a single compiler flag (basically type T will not be able to represent a null, a java method that does return T will have a signature of T | Null). In great hands it can be insanely productive and well-maintainable, but of course I know that giving it to developers that look at the project more as a learning/experimenting thing can cause quite some damage due to the language’s strength.
Re:Go 1.18 by eweise on Tuesday March 15, 2022 @08:02PM (#30693573)
They just released Scala 3 this this year so hardly stagnant. The community seems to promoting more pragmatic functional approaches recently which I think is going to make Scala much more popular in the future.
Re:Go 1.18 by yawaramin on Tuesday March 15, 2022 @07:42PM (#30693432)
I understand not keeping up with it but 'it's on its way to die' is just spreading FUD. It's more popular than ever. Disney+, Lego, Canada Post, basically every large bank–plenty of people are using it and adoption is increasing.
Re:Go 1.18 by mhio on Tuesday March 15, 2022 @09:58PM (#30694384)
What metric do you use for popularity? I'm more involved in the systems side so I'm definitely over exposed to Go projects. I would have considered Scala to be at least an order of magnitude less "popular" than Go. Kafka is the only open source project in Scala I can recall running into but there's probably a whole enterprise world I don't see.
Re:Go 1.18 by yashap on Wednesday March 16, 2022 @02:23AM (#30695891)
For open source projects, it’s very popular in the “big data” world. Kafka, as you mentioned, but also Spark, Flink, Summingbird, Scalding, etc.

And yeah, it’s a pretty popular backend language at some large companies. Twitter, LinkedIn, Netflix, the Guardian, Starbucks, AirBnB, Coursera, AT&T, etc. all make significant use of Scala.

Go is certainly bigger, but Scala has plenty of adoption too.

Re:Go 1.18 by kitd on Wednesday March 16, 2022 @04:36AM (#30696554)
Kafka is currently undergoing a rewrite into java.
Re:Go 1.18 by geodel on Wednesday March 16, 2022 @09:42AM (#30698693)
Indeed. To add further it is also facing competition from Apache Pulsar and NATS. Not to forget Redpanda a Kafka rewrite in C++.
Re:Go 1.18 by agallego on Wednesday March 16, 2022 @12:24PM (#30700806)
a small note on redpanda. Is not a `rewrite`. It is an entire new storage engine, different consensus protocol, different on-disk format, different internal RPC, no external dependencies, ...., in fact when i started it it was using flatbuffers as the API. What we did later to make money is add a kafka-API translation layer, but in terms of code size, is a very small part. The way i'd recommend thinking about it is a new storage engine that is compatible w/ kafka clients. https://github.com/redpanda-data/redpanda/tree/dev/src/v/kaf... - this is basically all the kafka-related code, the rest is net-new design.
Re:Go 1.18 by wfox on Wednesday March 16, 2022 @01:55PM (#30701915)
Source?
Re:Go 1.18 by kitd on Wednesday March 16, 2022 @05:29PM (#30704341)
Re:Go 1.18 by wfox on Wednesday March 16, 2022 @08:26PM (#30705991)
But the guy answering there is talking about the Java clients.
Re:Go 1.18 by yawaramin on Tuesday March 15, 2022 @07:39PM (#30693403)
Rust isn't a functional programming language. You could try OCaml, it's kind of a halfway point between Go and Haskell.
Re:Go 1.18 by int_19h on Tuesday March 15, 2022 @10:12PM (#30694490)
Rust has first-class functions. Not only that, but it also has immutability by default, and ADTs with pattern matching. If OCaml is functional, why wouldn't Rust be?
Re:Go 1.18 by chombier on Wednesday March 16, 2022 @05:03AM (#30696687)
Because of lifetime of captured variables in closures, mostly.

You can't really pass around functions freely like you would in Haskell/ML unless you start Box-ing/Rc-ing everything. But then it's not really idiomatic Rust anymore, IIUC.

Re:Go 1.18 by lmm on Wednesday March 16, 2022 @06:08AM (#30697026)
Rust doesn't really have first-class functions - you can't take an arbitrary snippet of code and turn it into a function value, because sometimes it will no longer pass the borrow checker.
Re:Go 1.18 by yawaramin on Wednesday March 16, 2022 @11:59PM (#30707517)
Well, one big one is lack of tail call elimination. If you can't write even a simple tail-recursive algorithm in the language, it's not a functional programming language.
Re:Go 1.18 by zozbot234 on Tuesday March 15, 2022 @08:34PM (#30693795)
A bit offtopic here, but it's a bit weird to see this argument that using .clone() in Rust is "littering" the code. The feature is there for a reason, and using it will still give you vastly more efficient code than in most other languages; quite possibly including Go.
Re:Go 1.18 by zinclozenge on Thursday March 17, 2022 @04:54PM (#30715787)
Sure it very possibly might outperform Go, and almost undoubtedly outperform python and ruby, but it might also make refactoring for further performance down the road very difficult. When I reach for Rust, it's because I want maximum performance right off the bat. Otherwise I'd just use go, or even java/c#.