News for hackers. Stuff that matters.
Re:Go: What We Got Right, What We Got Wrong by dekhn on Thursday January 04, 2024 @06:00PM (#38873510)
I asked Rob why he didn't like Java (Gosling was standing nearby) and he said "public static void main"
Re:Go: What We Got Right, What We Got Wrong by blibble on Thursday January 04, 2024 @07:26PM (#38874132)
still better than case deciding visibility
Re:Go: What We Got Right, What We Got Wrong by nyolfen on Thursday January 04, 2024 @10:54PM (#38875529)
i love this feature to be honest
Re:Go: What We Got Right, What We Got Wrong by cryptos on Friday January 05, 2024 @02:52AM (#38876765)
I consider that a bad practice, because it doesn't make things obvious. I guess it works so well in Go, because the language itself is small, so that you don't have to remember much of these "syntax tricks". Making things explicit, but not too verbose, is the best way in my opinion. JetBrains has done amazing work in this area with Kotlin.

    for (item in collection) {
        ...
    }

    list.map { it + 1 }

    fun printAll(vararg strings: String)

    constructor(...)

    companion object
I like the `for..in` which reads like plain English. Or `vararg` is pretty clear - compare that to "*" and the like in other languages. Or `constructor` can not be more explicit, there is no need to teach anyone that the name must be the same as the class name (and changed accordingly). Same is true for companion object (compare with Scala).
Re:Go: What We Got Right, What We Got Wrong by pron on Thursday January 04, 2024 @06:58PM (#38873929)
Well, that's taken care of: https://openjdk.org/jeps/463 (well you need `void main`)
Re:Go: What We Got Right, What We Got Wrong by grumpyprole on Thursday January 04, 2024 @06:12PM (#38873610)
Nice. My reply would have been something like: it combines the performance of Lisp with the productivity of C++. These days Java the language is much better though, thanks to Brian Goetz.
Re:Go: What We Got Right, What We Got Wrong by shakow on Thursday January 04, 2024 @09:03PM (#38874843)
> it combines the performance of Lisp with the productivity of C++

Is that supposed to be a jab? Because IME SBCL Lisp is in the same ballpark as Go (albeit offering a fully interactive development environment), and C++ is far from being the worst choice when it comes down to productivity.

Re:Go: What We Got Right, What We Got Wrong by grumpyprole on Friday January 05, 2024 @01:22AM (#38876333)
Hopefully you agree Lisp is more productive than C++? Lisp is however not quite fast or efficient enough to displace C++ completely, mainly because, like Java and Go, it has a garbage collector. C++ was very much the language in Java's crosshairs. Java made programming a bit safer, nulls and threads not withstanding, but was certainly not as productive as Lisp. Meanwhile Lisp evolved into Haskell and OCaml, two very productive languages which thankfully are inspiring everyone else to improve. Phil Wadler (from the original Haskell committee) has even been helping the Go team.
Re:Go: What We Got Right, What We Got Wrong by shakow on Friday January 05, 2024 @04:03AM (#38877119)
I agree; my point is simply that C++ is still OK-ish w.r.t. productivity, and Lisp is OK when it comes down to performances.
Re:Go: What We Got Right, What We Got Wrong by pjmlp on Friday January 05, 2024 @03:10AM (#38876864)
Common Lisp, is also among the GC based languages that offer mechanisms to do GC free allocations and has value types.

The only reason is the AI winter, and companies moving away from Lisp.

Re:Go: What We Got Right, What We Got Wrong by didntcheck on Friday January 05, 2024 @04:54AM (#38877370)
The performance of the JVM was definitely a fair criticism in it's early years, and still is when writing performance-critical applications like databases, but it's still possibly the fastest managed runtime around, and is often only a margin slower than native code on hot paths. It seems the reputation has stuck though, to the point that I've seen young programmers make stock jokes about Java being slow when their proposed alternative is Python
Re:Go: What We Got Right, What We Got Wrong by kaba0 on Friday January 05, 2024 @02:42PM (#38883779)
Just for an example: on the recent 1billion rows challenge, the top java contender takes only 2x as much time as a SIMD-optimized C one.
Re:Go: What We Got Right, What We Got Wrong by grumpyprole on Saturday January 06, 2024 @04:40PM (#38895780)
Yes it's possible to write Java without any boxing of primitives or garbage collection, but one can't use any of the standard libraries and it's not really Java one is writing but a very restricted subset. I don't think these benchmark are particularly indicative of real world performance. But of course Java is still hundreds (thousands?) of times faster than Python.
Re:Go: What We Got Right, What We Got Wrong by kaba0 on Saturday January 06, 2024 @05:17PM (#38896092)
It’s okay to do some allocations - it can be stack replaced, and even if it’s not, the cost is very negligible. The problem is mindless allocation, not allocation itself.
Re:Go: What We Got Right, What We Got Wrong by didntcheck on Friday January 05, 2024 @04:57AM (#38877388)
I've always found it eye rolling how often this is given as some sort of "mic drop" against Java. Yeah it's a little weird having to have plain functions actually be "static methods", but it's a very minor detail. And I really hope people aren't evaluating their long-term use of a language based on how tersely you can write Hello World
Re:Go: What We Got Right, What We Got Wrong by kaba0 on Friday January 05, 2024 @02:40PM (#38883744)
At least he knows something about a single other language! Honestly, I wasn’t sure about given the stupidity of go, and the warts it has.