Hacker News new | past | comments | ask | show | jobs | submit login

I really miss Pascal; it was a great and safe language for beginners. As it was extended with Objects and Modules, it was great for development.

But there are good reasons it was surpassed by C. In early Pascal, you got a pointer by allocating memory; you could not get a pointer to an existing variable. You'd be surprised how often that gets in the way when implementing a data structure. Just try to implement the following function in C without using the address-of operator:

  struct list *head = (void *) 0;
  void push_back (struct list *entry) {
      struct list **p = &head;
      while (*p != 0) p = &p->next;
      *p = entry;
  }
Pascal got better. But once you've switched to C, the sheer verbosity of Pascal is bothersome. Instead of "{" and "}" Pascal uses "begin" and "end". It uses "procedure" or "function" to introduce a function.

There's no going back, but I wish it was still available for learners. Java is comparable in terms of programmer safety, but has too much ridiculous boilerplate just to write "hello, world".




> Just try to implement the following function in C without using the address-of operator:

Pascal had `var` arguments, i.e. call-by-reference, which can be used for similar purposes. Call-by-reference isn't a complete replacement for C pointers, of course, but it also avoided the whole host of memory safety issues arising from C's more general model and which plague C to this day.

> But once you've switched to C, the sheer verbosity of Pascal is bothersome. Instead of "{" and "}" Pascal uses "begin" and "end". It uses "procedure" or "function" to introduce a function.

That's entirely subjective, I think. As somebody who grew up with Pascal and learned C later, I found the C syntax to be comparatively hard to read. I do favor the Modula-2/Eiffel/Ada approach of having "end" terminators instead of "begin" / "end" blocks (which share the troubles that braces have), though.


Lazarus IDE and Free Pascal Compiler are available if you really want to play with Pascal. It's super easy and fun to do simple GUI programming in it especially.


I don't understand the extreme focus on brevity, though it does seem to be mentioned regularly. In practice I don't notice a difference between "begin" and "{". It's not something I have to think about, and my typing speed exceeds the speed at which I'm able to determine what to type next.

I understand avoiding excessive amounts of large boiler plate where standard patterns are constantly repeated for no particular reason, but that's not a comparable situation to individual keywords.


Turbo Pascal was taught at most UK college in the 80's I think most electronic engineers and CS guys who went to school around then were exposed to it and you would be surprised how many PC/DOS programs in the 80's were written in it.


Turbo Pascal seemed like the perfect language for writing DOS games in the early 90's. Fast, you didn't need to know low-level things but you could always patch in assembly routines if you needed to.


Not just the 80s, until at least 2000 and probably a lot longer


I miss it too. It was my first post-BASIC language.

The AP Computer Science exam used to be given in Pascal, BTW.


Intro to computer science freshman year of high school in 2004 was still using turbo pascal and it was great. Dropping into BGI graphics mode was a great beginner friendly way to draw shapes and make some cool things. It's what got me into game development in earnest. I wish I could get this same setup to teach people with but BGI doesn't work in later versions of Windows.


This is why C++ standard folks want a simple basic 2D library available as part of the standard.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p026...


I think BGI graphics will still work in DOSBox. I remember having a setup a couple of years ago where I shared a directory between Windows and DOSBox. I'd edit the code in Windows using Sublime Text, and then pop in to DOSBox to build/run it.

So although it doesn't quite make BGI graphics based apps run directly on Windows...it's still quick and easy enough to have some fun. I did it specifically to give myself a way to make programming fun again at a time when I was feeling a bit burned out from working on massive, overly complex C# and JavaScript code all day at the office.


Turbo Pascal is, or at least until some time ago, was, also available from the Borland/Codegear/Embarcadero (hat tip to often useless or destructive M&A) Museum (along with other historical software from them, like Turbo C and so on). I had downloaded TP and TC from the Museum and tried them out a bit again some time ago, for old times' sake. Worked okay, IIRC, but I may have only used them for CLI work, not for BGI graphics. Worth a try though, for BGI, even on Windows, without installing DOSBox.

Update: Here is the link to the Museum:

http://edn.embarcadero.com/museum/antiquesoftware


Note: I should mention that, like it happens on many sites, the links sometimes do not work, or are broken. Caveat lector.


I wrote a ton of simple graphics programs in Turbo Pascal for fun, many of them related to math equations, generating curves from formulae, etc. Good fun. Still remember functions like HiRes; GotoXy(x, y) and the like :) It was a very productive environment and enabled very high speed of development.


How does Pascal compare to python for absolute begginers?


Pascal is a smaller language, and so easier to come to grips with at first glance. The syntax is tailored towards some verbosity which usually appeals to beginners. However, the downside is that you don't have a lot of leverage to do things in Pascal: Python pushes you down a path where you are writing something productive very quickly and can reach into the standard libraries to do many tasks - it makes some things very easy. Pascal requires some time to prepare the solution and encode it in syntax, and it's harder to find what you need, but there is usually code somewhere online that you can adapt. This is a lot to ask of beginners who want to do practical work, though. As of right now Pascal retains a lot of strength in desktop GUI code.

In terms of safety/dangerous code, modern Object Pascal style lets you be as dangerous as C if you want, but the default semantics are much more comfortable, and take you away from the danger zone more often.

Both Python and Pascal are relatively easy to get up and running with, and have pretty solid, standardized toolchains for industry use: in contrast C and C++ leave the build process relatively undefined and varying between compilers and platforms, which has resulted in a huge amount of friction to get any project building on a new machine.


Although I use Python extensively and started to forget about Pascal (ex Delphi guy here), Pascal is a much better beginner language IMO.

Start with Python and you're most likely to be stuck with dynamic typing/runtime mindset and it'll distance you too far away from OS level native land.

OTOH starting with Pascal, you'll learn a great deal of low level (well, relatively) stuff and that will make you appreciate the higher level languages when the time comes and will let you leverage them more efficiently. Also as a bonus, a big bonus I think, Pascal will let you feel at home if you ever need C/C++/D in your career.


Overall not well. It's statically typed, which can be helpful. And as mentioned, Pascal, was used widely in teaching so one would say well. However! So was Python, in it's ABC infancy.

Note that there are multiple Pascals, especially in the late 70s and 80s. Pure, true Pascal was annoying and restrictive [1].

No commercially successful Pascal was pure. The classic was Turbo Pascal which was disdained by purists but enormously successful. It's inventor went on to work on Delphi (a sort of Pascal which is still popular) C#, and Typescript.

https://en.wikipedia.org/wiki/Anders_Hejlsberg

1. e.g. semicolons were separators, not terminators. You'd get a syntax error if you had a semicolon after your last statement of a program/procedure.


IMO it's the best language for absolute beginners, if we are talking about classic Pascal without Borland extensions. It's very small language which could be taught in a few lessons yet it's powerful enough to learn classic data structures and algorithms.

The main drawback is that Pascal is not commercially successful, so you'll learn it and move on. Python, on the other side, is widely used, so Python knowledge is useful on its own.

Start from Pascal if you want to learn a lot of languages. I specifically would suggest to dive deep after Pascal and learn some assembly language, may be x86. They you'll have good basics and you can learn almost any language you want, C would be good, for example.

Main problem with Python IMO is that it's too high-level, it's dynamic, it uses GC. All those things are too far away from real machine code, so if you'll learn Python first, it might be hard to learn low-level programming and it's useful even if you're using JavaScript.


Harder in some ways, because types matter a lot more, private methods and less namespacing.

But the IDE makes GUI programming ridiculously easy, something Python can't compare on.


Not sure if Wirth designed Pascal to be beginner-friendly, but IMO, it is.


>Pascal got better. But once you've switched to C, the sheer verbosity of Pascal is bothersome. Instead of "{" and "}" Pascal uses "begin" and "end". It uses "procedure" or "function" to introduce a function.

I love both C and Pascal, and I'm a guy who has done a lot of both of them. Hey, its possible to like more than one language. With that background, I think your above points are minor (IMO of course) and should not be an issue in deciding between the two. One can easily get used to "begin" and "end" instead of braces, or vice versa. Same for the keywords "procedure" and "function". Plus, editor shortcuts in modern editors should be able to handle that, or a keyboard enhancement tool like AutoHotkey, vim's abbr command, or equivalents in other tools.

Better still, use both languages, at different times, as per needs, wants, convenience, etc.




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

Search: