Live data from Hacker News

Why use Pascal?

castle-engine.io

51–60 of 516 posts

Re: Why use Pascal?

#51

Earlier quoted context omitted.

Check out Free Pascal (FP) if you haven't already. It supports many platforms. You can check on their site if it supports CP/M if you need that. I would not be surprised if it did. The TUI IDE is very similar to Turbo Pascal, and lightning fast. The language has a lot more (advanced) features than Turbo Pascal, but you don't have to use them if you don't want to. The generated binaries were also very small, similar t…

Sadly it seems not to be available for such systems. Though for reference compiling my sample "Hello World" script on TP gives me a "hello.com" file which is 8320 bytes. 64k is as much memory as I have on the machine, so if it were 50-60k I'd be worried there would be no space left for anything else!

Free Pascal has support for Z80 which might work with some CP/M systems (AFAIK Z80 is backwards compatible with 8080 and some CP/M systems used Z80). You need to compile the compiler from source but it apparently can target the ZX Spectrum, so with some modification it might be able to target CP/M too.

Re: Why use Pascal?

#52
post #3

Earlier quoted context omitted.

Turbo Pascal and later Delphi were the first time when a programming language really spoke to me. Eventually, I went the C and C++ route, but I’ve always had a desire to return to more expressive languages. I had no idea that there was still a modern Pascal implementation, so I may just have to get reacquainted with my first love.

I’ve also a had an early acquaintance with Borland TP 7.0 at the time C99 was already around, and Pascal felt rather clumsy in comparison. The strong typing, the lack of a preprocessor, the verbosity in data declarations, the small set of available libraries just made my early programming self consider C superior.

Nowadays you look at pascal and see go without braces.

Re: Why use Pascal?

#53
Unless you want a C++ with a different syntax and less features then there's no reason to learn Pascal in 2023.

And the syntax is much worse, you can't even declare variables in the middle of a function it has to go before the function. This slows you down from real work (art code comes later). It also makes worse code as declaring near the usage point makes code more clear.

Re: Why use Pascal?

#54
post #35

Earlier quoted context omitted.

The syntax is timeless, because it is much closer to math than B/BCPL/C heritage. It has its own issues but overall it is much better thought out than most other languages. Here is a comment I wrote a couple of months ago with more arguments for Pascal's syntax: "Yes, Rust does indeed and a long time before that it was Pascal. I really love Pascal's syntax, it makes a lot of sense when you approach it with a math bac…

It's only "mathematical" if you chose very specific parts of the language from a very specific version of Pascal when looked at at a very specific angle. E.g. the argument falls apart immedately: - there's no assignment operator in maths - there are no procedures in maths, everything is a function - functions cannot be nested in maths (unless I'm mistaken) - types is maths, but Pascal uses a very narrowed down and du…

"- there's no assignment operator in maths"

There is no assignment but in math we use := to express that two things are equal per definition. I never said it was the same thing, just that it is the closest thing. From a math perspective it makes total sense, while singular = for assignment makes no sense at all. Especially when you want express the concept of equality as well and cannot use the obvious choice = anymore because you already used it for something else.

"- there are no procedures in maths, everything is a function"

Exactly and that's why functions and procedures in Pascal are separate things, like it is meant to be. Functions have an equivalent in math, procedures don't. Mixing the two concepts up into the weird thing C calls a function is just wrong.

"- functions cannot be nested in maths (unless I'm mistaken)"

In some sense they can. In C they can't because of technical restrictions, no one ever was fond of that restriction, not even back in the day.

"- types is maths, but Pascal uses a very narrowed down and dumbed down version of it"

Pascal is a programming language, not math. My point is solely that Pascals syntax is superior to C's because (among other reasons) the former is closer to centuries old tried and tested and well established syntax of mathematical notation. It has some consistency and elegance and certainly flaws as well. C's syntax decisions were more driven by long gone technical restrictions than what makes sense to a human. Now we have to live with that baggage.

Re: Why use Pascal?

#55
post #9

I disagree with some of their reasons. Modern: Object Pascal isn't a modern language. It was modern in 1998, maybe, but it hasn't evolved much since then. Latest big change was the addition of generics, behind almost any other language. Fast: FPC doesn't generate particularly fast code, and the nature of OP objects doesn't help with locality. It's faster than scripting languages, but generally slower than AOT compile…

> It's faster than scripting languages, but generally slower than AOT compiled languages, even those with GC. Not sure about FPC, but Delphi 7 was on par with C++ ten years ago in competitive programming, that is about 2-3 times faster than Java. By competitive programming I mean very short (1-3 seconds per execution max, so any JIT is at disadvantage), CPU-bound single-threaded heavily algorithmic computation on mos…

reasons why Delphi was/is a strong option for CP:

1. Fast compilation enables edit-compile-run workflow. Fast iteration enables solving CP problems faster.

2. Native dynamic arrays, native String type

3. Easy to learn language for middle/high schoolers.

4. Usefulness for outside CP, for example I created GUI programs in Delphi for clients and earned $$$ while in 8th grade, right after I was done with competition season.

Re: Why use Pascal?

#56

Why? Old languages must remain around for legacy support. However, it's hard to see the point of shoe-horning all those modern features into an old language. I write a lot of Java, and really, almost everything since Java 8 should not have been added. Lambdas, for example, are a kludge in Java. Want modern features? Use a modern language. If you want to stay in the Java ecosystem, for example, you could use Kotlin. I…

> Use a modern language. If you want to stay in the Java ecosystem, for example, you could use Kotlin.

That's easier in Java given how easy it is to interop between languages (see also Clojure). What if I'm using C++? There's no easy upgrade path to anything else.

There's still value to "shoe-horning all those modern features". I might not start a project with C++ today, instead choosing a modern language (e.g. Rust) instead. But there are millions of lines of C++ already written that would be improved by modern features (see how C++11 changed the landscape).

Re: Why use Pascal?

#57

Why? Old languages must remain around for legacy support. However, it's hard to see the point of shoe-horning all those modern features into an old language. I write a lot of Java, and really, almost everything since Java 8 should not have been added. Lambdas, for example, are a kludge in Java. Want modern features? Use a modern language. If you want to stay in the Java ecosystem, for example, you could use Kotlin. I…

lambdas are a kludge? Really? You prefer creating one-method anonymous classes instead?

Re: Why use Pascal?

#58

Unless you want a C++ with a different syntax and less features then there's no reason to learn Pascal in 2023. And the syntax is much worse, you can't even declare variables in the middle of a function it has to go before the function. This slows you down from real work (art code comes later). It also makes worse code as declaring near the usage point makes code more clear.

Can’t speak about Object Pascal, but the old Pascal was objectively better than C. You can like or dislike the differences in syntax, but Pascal’s type system was pretty solid which can’t be said about C

Re: Why use Pascal?

#59
post #58

Unless you want a C++ with a different syntax and less features then there's no reason to learn Pascal in 2023. And the syntax is much worse, you can't even declare variables in the middle of a function it has to go before the function. This slows you down from real work (art code comes later). It also makes worse code as declaring near the usage point makes code more clear.

Can’t speak about Object Pascal, but the old Pascal was objectively better than C. You can like or dislike the differences in syntax, but Pascal’s type system was pretty solid which can’t be said about C

The way I remember the pascal type system is arrays of different lengths were different types.

Re: Why use Pascal?

#60

As you can see in the comments, Pascal has significant anti rating. I would meditate on that fact if I was Pascal evangelist, instead of reposting such texts over and over as years go by.

[flagged]
Post reply on HN