Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's completely missing the point.

While Pascal can be used for serious work, it is first and foremost a teaching language friendly to beginners meant for introducing people (who back in the day) likely started with something like BASIC to concepts of structured and objects oriented programming. The syntax is easy to learn, fairly clean and the language has very fast compilation (C++ really can't compete here). Which is important when teaching - permits rapid iteration.

Concerning archaic/rigid syntax - there are some good reasons why the syntax is like it is. E.g. the concept of declaring a variable in the middle of a block didn't exist in Pascal for a reason - you had to actually allocate memory before you used it, the compiler didn't hide this from you. That's why variables are declared at the start of the block.

When Pascal has been designed it was running on various 8bit and 16bit machines and was originally compiled into bytecode (p-code), so optimizations like statement reordering common today (which permits to declare the variables in the middle of blocks) didn't exist/weren't possible/common.

These days you have a ton of abstractions between you and the "metal" running your code, Pascal is a language designed for much simpler time and hardware.



I was teaching programming with Pascal until three years ago, and I think the pedagogical argument might have made sense in the past, but not in 2023 (or 10 years ago for that matter).

The syntax is rigid in all the wrong places. For example, not being able to declare variables anywhere doesn't really help students, this isn't something that typically leads them to errors.

What does lead to lots of errors? Dereferencing uninitialized pointers or going out of bounds in arrays, for example. And the language and compiler won't help you one bit there. Same opaque segmentation faults as with C, same unpredictable behavior as with C, but with worse tooling for debugging.

Compilation time is not an issue in 2023 - well, maybe it is if you compare with C++, but C++ is about the worst non-joke language I can think of for learning (and it was my first language!). C, Java, Python, etc. are fast enough.

Pascal had its time but I don't think there is much reason to use it now, outside of pure curiosity or wanting to try a historical language.


>For example, not being able to declare variables anywhere doesn't really help students, this

Disagree. Creating variables in the middle is the reason why beginners create spaghetti code and mix up control flow. This is the reason for dangling pointers, memory leaks, and de-referencing pointers in wrong places.

If student needs to declare variable in the middle of method, this is a good sign to split the method or rethink control flow.

What really I learned from Pascal is managing clean control flow, and var section in the beginning forces you to think in advance what you are going to need in this particular method vs what needs to be done in a separate function.


>> Pascal had its time but I don't think there is much reason to use it now, outside of pure curiosity or wanting to try a historical language.

I use Pascal only for side job/hobby, not for daily work. Lazarus+FPC is still my #1 choice for desktop app (is this still a "thing" in 2023?). No Electron, no JVM etc etc.

For writing web/server/backend stuffs, kinda hard to argue with Go.


> While Pascal can be used for serious work, it is first and foremost a teaching language friendly to beginners

But that's not what the linked article argues as a reason to use (Object) Pascal.

> The syntax is easy to learn, fairly clean and the language has very fast compilation (C++ really can't compete here). Which is important when teaching - permits rapid iteration.

1. There are other languages than C++ you know...

2. For language-teaching purposes, basically _any_ language compiles essentially instantaneously on modern hardware (including C++).


Much of the original Mac was Pascal based with 68k for performance pinch points.

Of note it was faster to compile than C with MPW Shell.


Many years ago I learned programming that way. Pascal then C, Assembler and VB Script. I completely agree with the argument that it is a great teaching language. Our teachers even explained this to us. JS, C, C#, Python and Java syntax is just crazy for real newbies. Curly braces basically do not exist in normal life and scare people. And Go and the functional group of languages are just not understandable with their concepts. Imperative programming is much easier to understand.

Pascal is in a sweet spot.


I seem to recall Golang being inspired by it too, but I could be misremembering.


I believe you're right. iirc, that's where the := notation comes from




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: