4 ms·
As usual, lets revisit something that Pascal could do in 1976, type StatusCodes = (Success, Ongoing, Done) Go in 2025, type StatusCodes int
by pjmlp 1y ago
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 1y agoWhere's Pascal today?
- terminalbraid 1y agoJust below Go with Perl in between. All above Fortran, all below Visual Basic. https://www.tiobe.com/tiobe-index/ https://www.tiobe.com/tiobe-index/
- ofrzeta 1y agoIt's alive and kicking, right? :) https://www.freepascal.org https://www.freepascal.org They even have a game engine that can compile to a WASM target: https://castle-engine.io/web https://castle-engine.io/web
- dardeaup 1y agoOuch!! 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.
- pjmlp 1y agoBeing used by these folks, https://www.embarcadero.com/ 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.
- fuzztester 1y agoPlease do. Would be interesting to read.
- kragen 1y agoPascal 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.
- 813ac4312b25c 1y ago[flagged]
- pjmlp 1y agoRust did not exist in 1976.
- chiffaa 1y agoPeople 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
- jen20 1y agoSum types are not the same as the trivial example above. Sum types are actually useful, for one thing.
- torginus 1y agoWhere do you put the comments on the Pascal version?
- pjmlp 1y agoWhere you feel like it.
- jen20 1y agoIf Pascal doesn't have required exhaustive pattern matching, it's no better than Go or C# in this regard.
- pjmlp 1y agoGo is the one being discussed as ignoring history. C# thankfully was designed by someone that appreciates type systems, maybe you should revisit it.
- jen20 1y agoNot enough to add sum types or exhaustive pattern matching... now F# - that was appreciated by someone that appreciates type systems.
- frou_dh 1y agoDoes Pascal's break down like this Go does? func f(x StatusCode) { } f(728347) // There's no such status. Whateverz, no compile error.
- Mawr 1y agoHow 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.