Comment by pjmlp

Comment by pjmlp 2 days ago

24 replies

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
    )
thiht 2 days ago

Where's Pascal today?

  • dardeaup 2 days ago

    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.

  • kragen a day ago

    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.

jen20 a day ago

If Pascal doesn't have required exhaustive pattern matching, it's no better than Go or C# in this regard.

  • pjmlp a day ago

    Go is the one being discussed as ignoring history.

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

    • jen20 a day ago

      Not enough to add sum types or exhaustive pattern matching... now F# - that was appreciated by someone that appreciates type systems.

  • frou_dh a day ago

    Does Pascal's break down like this Go does?

        func f(x StatusCode) {
        }
    
        f(728347) // There's no such status. Whateverz, no compile error.
    • Mawr a day ago

      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.
      • frou_dh 21 hours ago

        The nature of Swiss cheese is that it can't be all hole and there has to be some non-hole too

        • jen20 14 hours ago

          Raclette is Swiss cheese without holes. That is proper ADT in this anaology.

813ac4312b25c 2 days ago

[flagged]

  • chiffaa a day ago

    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

  • pjmlp 2 days ago

    Rust did not exist in 1976.

    • jen20 a day ago

      ML did, however (1973), and had..... sum types!

      • pjmlp a day ago

        Yes, and still doesn't change the fact that Go messed up.

  • jen20 a day ago

    Sum types are not the same as the trivial example above. Sum types are actually useful, for one thing.

    • pjmlp a day ago

      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.

      • jen20 a day ago

        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.