Most active commenters
  • pjmlp(7)
  • jen20(6)

←back to thread

Go is still not good

(blog.habets.se)
644 points ustad | 24 comments | | HN request time: 0.896s | source | bottom
1. pjmlp ◴[] No.44983556[source]
As usual, lets revisit something that Pascal could do in 1976,

    type

    StatusCodes = (Success, Ongoing, Done)
Go in 2025,

    type StatusCodes int

    const (
        Success StatusCodes = iota
        Ongoing
        Done
    )
replies(4): >>44983559 #>>44983614 #>>44983648 #>>44986881 #
2. thiht ◴[] No.44983559[source]
Where's Pascal today?
replies(5): >>44983595 #>>44983604 #>>44983630 #>>44983657 #>>44989310 #
3. terminalbraid ◴[] No.44983595[source]
Just below Go with Perl in between. All above Fortran, all below Visual Basic.

https://www.tiobe.com/tiobe-index/

4. ofrzeta ◴[] No.44983604[source]
It's alive and kicking, right? :) https://www.freepascal.org They even have a game engine that can compile to a WASM target: https://castle-engine.io/web
5. dardeaup ◴[] No.44983630[source]
Ouch!! Pascal's lack of popularity certainly isn't due to the fact that it supports such nice enumerated types (or sets for that matter). I think he was just pointing out that such nice things have existed (and been known to exist) for a long time and that it's odd that a new language couldn't have borrowed the feature.
6. torginus ◴[] No.44983648[source]
Where do you put the comments on the Pascal version?
replies(1): >>44983669 #
7. pjmlp ◴[] No.44983657[source]
Being used by these folks, https://www.embarcadero.com/

If you prefer, I can provide the same example in C, C++, D, Java, C#, Scala, Kotlin, Swift, Rust, Nim, Zig, Odin.

replies(1): >>44988665 #
8. pjmlp ◴[] No.44983669[source]
Where you feel like it.
9. pjmlp ◴[] No.44983683[source]
Rust did not exist in 1976.
replies(1): >>44986925 #
10. chiffaa ◴[] No.44986434[source]
People want sum types because sum types solve a large set of design problems, while being a concept old enough to appear back in SML in 1980s. One of the best phrased complaints I've seen against Go's design is a claim that Go language team ignored 30+ years of programming language design, because the language really seems to introduce design issues and footguns that were solved decades before work on it even started
11. jen20 ◴[] No.44986881[source]
If Pascal doesn't have required exhaustive pattern matching, it's no better than Go or C# in this regard.
replies(2): >>44987113 #>>44988670 #
12. jen20 ◴[] No.44986889[source]
Sum types are not the same as the trivial example above. Sum types are actually useful, for one thing.
replies(1): >>44987136 #
13. jen20 ◴[] No.44986925{3}[source]
ML did, however (1973), and had..... sum types!
replies(1): >>44987126 #
14. pjmlp ◴[] No.44987113[source]
Go is the one being discussed as ignoring history.

C# thankfully was designed by someone that appreciates type systems, maybe you should revisit it.

replies(1): >>44987444 #
15. pjmlp ◴[] No.44987126{4}[source]
Yes, and still doesn't change the fact that Go messed up.
16. pjmlp ◴[] No.44987136{3}[source]
No one is asking for sum types, what Pascal does would already be a huuuuge improvement.

But I guess Go devs love to type their beloved boilerplate, it gives fuzzy feelings.

replies(1): >>44987438 #
17. jen20 ◴[] No.44987438{4}[source]
It wouldn't move the needle at all except people looking to nitpick.

And concretely, _I_ want Sum types in Go. I also want them in C# and every other language I might have to use.

18. jen20 ◴[] No.44987444{3}[source]
Not enough to add sum types or exhaustive pattern matching... now F# - that was appreciated by someone that appreciates type systems.
19. fuzztester ◴[] No.44988665{3}[source]
Please do. Would be interesting to read.
20. frou_dh ◴[] No.44988670[source]
Does Pascal's break down like this Go does?

    func f(x StatusCode) {
    }

    f(728347) // There's no such status. Whateverz, no compile error.
replies(1): >>44990703 #
21. kragen ◴[] No.44989310[source]
Pascal evolved into Modula-2, which Wirth then simplified into Oberon. His student Griesemer did his dissertation on extending Oberon for parallel programming on supercomputers. Concurrently, Pike found Modula-2 an inspiration for some languages he wrote in the 80s and 90s. He got together with Griesemer and Ken Thompson to rework one of those languages, Newsqueak, into Golang. So that's where Pascal is today.
22. Mawr ◴[] No.44990703{3}[source]
How often do you pass literals into your functions?

    f(728347) // There's no such status. Whateverz, no compile error.
    a := 728347
    f(a) // Compile error.
replies(1): >>44993952 #
23. frou_dh ◴[] No.44993952{4}[source]
The nature of Swiss cheese is that it can't be all hole and there has to be some non-hole too
replies(1): >>44996018 #
24. jen20 ◴[] No.44996018{5}[source]
Raclette is Swiss cheese without holes. That is proper ADT in this anaology.