[HN Gopher] Modern Pascal is still in the race (2022)
___________________________________________________________________
Modern Pascal is still in the race (2022)
Author : open-source-ux
Score : 45 points
Date : 2023-10-11 14:02 UTC (1 hours ago)
(HTM) web link (blog.synopse.info)
(TXT) w3m dump (blog.synopse.info)
| jchw wrote:
| Hmm meh. I have a soft spot for Delphi/Object Pascal but I think
| the case here is not great. What it looks like at a glance is
| they wrote a better Pascal program than the Go one it was
| competing against, rather than just idiomatically port it. A fine
| approach, but it doesn't tell us _that_ much. Specifically, it
| doesn 't tell us very much about programming languages.
|
| Go has plenty of weaknesses versus Pascal, but two commonalities
| of the languages are lightning fast compile times and a pretty
| good experience for modelling data structures. Pascal is
| undoubtedly lower level and does not guarantee memory safety,
| whereas Go does but its GC is often less efficient and more
| memory-heavy than manual allocation.
|
| Blow for blow, though, I'd say the largest weak point for Pascal
| is a somewhat archaic syntax and for Go, honestly, the
| concurrency model. (Channels are nice, until they are not. I feel
| as though it's easier, though not necessarily easy, to write
| correct programs using mutexes than Go channels in many cases.
| This is weird, because nothing has changed about the old shared
| memory with locks model since it was the source of so many
| problems. Yet, programmers, computers and toolchains have changed
| a lot. Rust with locks is a great example.)
|
| But the biggest problem for Pascal is the lack of a strong killer
| app. Back in the day, libraries like VCL made Delphi amazingly
| productive for desktop apps. But VCL/LCL doesn't really hold up
| as well these days, where desktop apps are less important and the
| important features of GUIs has shifted a lot. That leaves Delphi
| and Object Pascal as a sort-of also-ran: It's not that Go is
| especially good, in fact I'd argue its claim to fame and namesake
| (the concurrency model) just wound up being kind of ... bad. But,
| now that it's here and popular, there's little reason for e.g. Go
| developers to switch to Object Pascal, a less supported language
| with less of a job market, less library support, etc.
|
| And that really is a shame, because it isn't really a reflection
| of Object Pascal being unfit for modern software development.
| rob74 wrote:
| Delphi (and probably also Free Pascal?) is not wholly memory
| safe, but at least it has bounds checking for arrays and a sane
| string type, which is more than you get with C...
|
| I'm an ex-Delphi developer myself, and actually Go and Pascal
| are more closely related than you might think at first glance:
| Go code looks mostly like a C-family language, but the
| declaration syntax ("a int" instead of "int a") and the
| "package" concept which helps achieve fast compilation times
| are borrowed from Pascal. And both have a ":=" operator,
| although in Go it declares and assigns variable(s) with type
| inference, while in Pascal it's any assignment.
| jerf wrote:
| "Channels are nice, until they are not. I feel as though it's
| easier, though not necessarily easy, to write correct programs
| using mutexes than Go channels in many cases."
|
| The rule for mutexes is, never take more than one. As long as
| you only ever take one, life is pretty good.
|
| When all you had was mutexes as your primitive, though, that
| became a problem. One is not enough. You can't build a big
| program on mutexes, and taking only one at a time.
|
| But as you add other concurrency primitives to take the load
| off of the lowly mutex, and as you do, the mutex returns to
| viability. I use a lot of mutexes in my Go code, and I can,
| precisely because when I have a case where I need to select
| from three channels in some complicated multi-way, multi-
| goroutine choice, I _have_ the channels for that case. The
| other concurrency mechanisms take the hard cases, leaving the
| easy cases for mutexes to be fine for once again.
|
| The story of software engineering in the 1990s was a story of
| overreactions and misdiagnoses. This was one of them. Mutexes
| weren't the problem; misuse of them was. Using them as the only
| primitive was. You really, really don't want to take more than
| one at a time. That goes so poorly that I believe it nearly
| explains the entire fear of multithreading picked up from that
| era. (The remainder comes from trying to multithread in a
| memory-unsafe language, which is also a pretty big mistake.)
| Multithreading isn't trivial, but it isn't _that_ hard... but
| there are some mistakes that fundamentally will destroy your
| sanity and trying to build a program around multiple mutexes
| being taken is one of them.
| astrodust wrote:
| Delphi was really a "Concorde moment" in that it was actually
| _rapid_ , both in terms of development speed, and performance,
| which was somehow forgotten as the web emerged.
|
| Forgotten to the point that people thought Visual Basic was a
| good idea.
| misja111 wrote:
| Delphi was great but a major deal breaker was that is was not
| free to use.
| davidw wrote:
| If you have to loudly proclaim you're still important...
| dbsmith83 wrote:
| I used Delphi in the 90's and early 00's, and really loved how
| simple it was to create desktop applications. I tried to get back
| into Pascal via Lazarus a few years ago, but was just very turned
| off by Pascal itself. The conventions just differ so much from
| other more popular languages that I use for work now, and there
| just isn't the same level of stack overflow questions/answers to
| make it easy to pick up. I guess with ChatGPT, it should be a lot
| easier to pick up now, so maybe I should give it another go.
| Svip wrote:
| This article reads more like an ad for mORMot 2 than Pascal. I've
| been out of the Pascal game for a few years, so I had to look up
| mORMot 2.[0] Apparently Synopse are the maintainers of it.
|
| The article basically compare their CSV/JSON serialising library
| to Go's standard CSV/JSON libraries. Looking at the Go code, it's
| pretty clear why it has memory issues, it reads _all_ the lines
| into a single object (well, `[][]string`) immediately, rather
| than reading line for line (which takes advantage of the stream).
|
| I am not sure how this is remarkable and impressive for Pascal.
| They talk about how you don't need to use the
| `try..finally..Free` routine all the time, but that's only if the
| object in question is an interface. Interfaces are somehow
| handled by a reference counter in Object Pascal, so you need to
| know how to operate on objects vs interfaces, because they act
| very different. Pascal is full of these quirks.
|
| [0] https://github.com/synopse/mORMot2
| soliton4 wrote:
| pascal was the 2nd language i learned after basic and it was the
| best time of my learning life. the fact that you could add inline
| assembler code and the early attempts of object oriented
| programming were amazing. it was turbo pascal 6.0 btw.
| wiz21c wrote:
| Inline assembler was a killer feature: you could optimize bits
| of your code without having to understand how an assembler
| works and without having to deal with a linker as Pascal
| compiler did everything itself.
|
| Great time indeed !
| anta40 wrote:
| >> And... Pascal is still in the race for sure!
|
| And what about.. umm... Modula 2/3 or Oberon? They don't gain as
| much industry attractions as Pascal does, eh?
| runlaszlorun wrote:
| I def have a soft spot for Pascal. And I think Niklaus Wirth
| deserves more recognition in broader circles for his foundational
| work with pcode, compilers, Oberon, etc. I learned Pascal like
| many of us growing up in the early PC era and never could look at
| BASIC the same way again (or respect Gates for his love of it,
| lol). I think having such a highly structured language at a young
| age did wonders.
|
| But these days folks are mostly used to the C style syntax. And
| I'm not even arguing that it is a better language than C or
| others. But the whole industry has gone overall into believing
| that anything newly 'invented' is good and anything that's been
| around a while is passe. Ironically, at the same time as the core
| technologies we use are based on decades old tech like Unix,
| relational databases, TCP/IP, etc. And many others like Lisp and
| Smalltalk fell by the wayside at least partly due to performance
| issues that were made irrelevant by Moore's law long ago.
|
| Oh humans... :)
|
| Btw, Logo is another one that's under appreciated. Seymour Papert
| was brilliant in making programming more visual and intuitive for
| kids. And I didn't actually know until recently it's actually a
| Lisp based language with a lot of power. Who knew?
|
| In some parallel universe, I'd love to see folks like those,
| along with many others from that era, as the ones we heap
| recognition on instead of our worship of current tech
| billionaires. Those guys generally understood the hardware,
| software, and core theory. Given the mess that is computing and
| the internet, it's a shame that we'll be losing them over the
| next few decades.
| cdelsolar wrote:
| Nice mormot.
| zwnow wrote:
| Having to write C/AL to make a living, which is based on Pascal,
| I can safely say it shouldnt be in the race anymore...
| elteto wrote:
| Interesting take. Pascal is definitely a niche language but
| most of the community around FPC and Lazarus seems very
| positive and welcoming.
|
| Would you mind expanding on why you feel this way? What Pascal
| do you use? Do you use Delphi or FPC/Lazarus? What don't you
| like about the language (or your particular vendor
| implementation)?
| zwnow wrote:
| I have to say I wrote this as more of a joke as I do have no
| actual experience with Pascal. Looking at the syntax I just
| assumed it to be extremely similar to the language I have to
| work with on a daily basis. And with that, just as limited.
|
| C/AL is a product of Microsoft and is only used in their ERP
| Software Navision. It's a horrible experience to work with as
| you don't have a lot of modern languages features just for
| the sake of readability.
|
| At some point in the article the author wrote that Rust code
| isn't readable for example. I'd argue code shouldn't have to
| be readable by non-programmers. And especially not if the
| language sacrifices features like creating objects or dynamic
| arrays...
|
| But as I wrote, I don't have actual experience with Pascal so
| maybe it's actually better.
| bitwize wrote:
| Free Pascal is a lot more robust and featureful than
| whatever God-awful ERP language you have to work in. It's a
| spiritual descendant of Turbo Pascal and Delphi, which were
| used to develop diverse applications from line-of-business
| to games for decades. Dynamic memory allocation and objects
| are built-in. It is definitely NOT the Pascal of
| Kernighan's "Why Pascal Is Not My Favorite Programming
| Language".
| falker wrote:
| PS4 emulator/compat layer in FP: https://github.com/red-
| prig/fpPS4
| b800h wrote:
| I hope this isn't hosted on Pascal. Got a 502.
| doublerabbit wrote:
| Probably got a 502 for it not being hosted on Pascal.
|
| But iirc, HN is Lisp?
___________________________________________________________________
(page generated 2023-10-11 16:00 UTC)