| ▲ | pjmlp 4 days 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
)
|
|
| ▲ | torginus 4 days ago | parent | next [-] |
| Where do you put the comments on the Pascal version? |
| |
|
| ▲ | jen20 3 days ago | parent | prev | next [-] |
| If Pascal doesn't have required exhaustive pattern matching, it's no better than Go or C# in this regard. |
| |
| ▲ | pjmlp 3 days ago | parent | next [-] | | 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 3 days ago | parent [-] | | Not enough to add sum types or exhaustive pattern matching... now F# - that was appreciated by someone that appreciates type systems. |
| |
| ▲ | frou_dh 3 days ago | parent | prev [-] | | 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 3 days ago | parent [-] | | 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 3 days ago | parent [-] | | The nature of Swiss cheese is that it can't be all hole and there has to be some non-hole too | | |
| ▲ | jen20 3 days ago | parent [-] | | Raclette is Swiss cheese without holes. That is proper ADT in this anaology. |
|
|
|
|
|
| ▲ | thiht 4 days ago | parent | prev | next [-] |
| Where's Pascal today? |
| |
| ▲ | dardeaup 4 days ago | parent | next [-] | | 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. | |
| ▲ | pjmlp 4 days ago | parent | prev | next [-] | | 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. | | | |
| ▲ | terminalbraid 4 days ago | parent | prev | next [-] | | Just below Go with Perl in between. All above Fortran, all below Visual Basic. https://www.tiobe.com/tiobe-index/ | |
| ▲ | ofrzeta 4 days ago | parent | prev | next [-] | | 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 | |
| ▲ | kragen 3 days ago | parent | prev [-] | | 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. |
|
|
| ▲ | 813ac4312b25c 4 days ago | parent | prev [-] |
| [flagged] |
| |
| ▲ | chiffaa 3 days ago | parent | next [-] | | 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 4 days ago | parent | prev | next [-] | | Rust did not exist in 1976. | | |
| ▲ | jen20 3 days ago | parent [-] | | ML did, however (1973), and had..... sum types! | | |
| ▲ | pjmlp 3 days ago | parent [-] | | Yes, and still doesn't change the fact that Go messed up. |
|
| |
| ▲ | jen20 3 days ago | parent | prev [-] | | Sum types are not the same as the trivial example above. Sum types are actually useful, for one thing. | | |
| ▲ | pjmlp 3 days ago | parent [-] | | 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 3 days ago | parent [-] | | 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. |
|
|
|