Hacker News new | ask | show | jobs
by antimagic 4081 days ago
OK, you've piqued my curiosity. I followed a very similar path to your own, but I have ended up as a C programmer professionally, and I'm curious as to what differences you see in the two languages. To me, they are essentially the same, give or take some syntactical differences. Functions and structs, direct access to memory, no classes, etc etc etc.
2 comments

Good question. And my answer comes with the caveat that I'm not a computer scientist, and could in fact have been wrong. I've made one or two bad bets. I also bet that programming wouldn't be much of a career.

With that said, it seemed in C that you were closer to the hardware implementation of what pointers do (for instance you could do arithmetic on pointers), making it easier to reference an int with something that was supposed to be a float, or something like that, and to generally make those kinds of memory violation and array bounds errors. Nothing like that was in the original conception of Pascal, because Pascal was supposed to be hardware independent.

I felt like letting your data structures be your program was a natural aspect of Pascal, but something you had to discipline yourself to do in C. Also, the parameter passing syntax for Pascal seemed more readable than all of those *'s and &'s. It could all have boiled down to me understanding Pascal syntax better than C syntax.

This was all based on the C of the early 80s. When I mentioned some of these things to a real C programmer later on, he said: There are compiler warnings for those things nowadays. My favorite language du jour is Python, but I use C when messing around with microcontrollers, so I've finally gotten used to it.

Hah :) I was expecting you to come back with something about typecasting, which Pascal, as conceived by Wirth, was determined to make as difficult as possible, if not flatout impossible. This limitation made writing performant software in standard Pascal quite difficult. Which is why most of the popular Pascal implementations provided extensions to make it possible to use Pascal for real problems. I'm thinking notably of MPW Pascal, which was used to write much of the system software for early Macs.
You guessed right. And after I made that pronouncement to myself about C, I kinda lost touch with the programming community, as Turbo Pascal and my programming skills got me through college and gradual school in physics. When I finally came back up for air, of course C had won out, but programming a graphical platform with a low level language seemed too hard, and I reverted to higher level tools such as HyperCard, Visual Basic, and today, Python.
I write this on https://www.reddit.com/r/programming/comments/33h4t0/lazarus...

Pascal itself have some "obvious" advantages:

1- Fast compilation

This hide a non-obvious advantage: The language is more coherent/well designed/simple in principle. This have a cascade effect along the way.

2- Anything C could do, Pascal too. Even the old Apple OS was done in a dialect of pascal.

BTW, I use Delphi instead of MS C++. Not miss C++ at all

3- More sane type system.

4- A good string type!

5- More readable syntax

Some people will contest the pascal syntax is verbose.

Let's agree about that. However most syntax (with the exception of BEGIN/END) is useful. We can disagree if more/less verbosity is good/bad, but is NOT the point.

Is not just the verbosity, is the predictability and less-ambiguity of it. Even if the keywords were replaced to shorted ones (and clamp down on the verbosity) you will get something very-alike to python in spirit (+ static type system).

This come again from the "obvious" "Pascal compilers ARE fast". They are fast, because, the syntax/language is made to be fast. In fact, most pascal compilers are 1-pass compilers.

Is NOT a coincidence that this is the case: The creator of Pascal wrote one of the most influential papers about build your own compiler:

https://en.wikipedia.org/wiki/Algorithms_%2B_Data_Structures...

A modern take of it is presented in https://github.com/Araq/Nimrod

This is why most people agree is easier to program in a dialect of pascal (like Delphi or FreePascal) than in C/C++, for the same kind of tasks. The clarity that bring the syntax could be a part of it (some of us believe) but in the end is that the language is more coherent. Is similar to "python vs ruby" where one is more "magical" than the other.

C/C++/Perl/Javascript is more about "A millon ways, not well integrated, in how, maybe, depending on ???, to do stuff" versus Pascal/Python "A predictable, single/small ways to do stuff".

Probably, GO is a spiritual sucessor in this area, where fast-compile times are enabled (obviously, among other things) because the language is simpler. That make it in contrast with Rust.

This are some of the most superficial things. As like with any language, is better to spend some time using it to appreciate it more.

I use it (Delphi) when I was a noob, and I can do stuff that was impossible to me to do in C/C++ (ie: C++ is more complex for the same). Where I read how do anything with them was full walls of code/mess, in Delphi I found more simpler ways. Spoiled badly, because the VCL was absolutely superior than the mess that MCF mean to do windows applications. And the the database libraries round around the ADO, DAO, .NET DataSet and that other stuff people still believe are good ideas...

Ada put far more to the table. The main problem was the high cost, that made it out of reach for many. This was a serious trouble with other good languages, like smalltalk.

ADA have a lot of the things modern C#/Java is doing now, with what GO, Eiffel and others give too. Still suffer from the "ADA is mainly a costly commercial compiler", but anyway...

Modula, in the other hand, look great. Sadly not much exposure of it, and Delphi take the whole "Pascal space" to itself

Delphi is amazing, but is the most tragic story of any language ever: Is like if the owners hate it with more passion than any.

Is like the Firefly show: Doomed by the studio, but the fans love it to death!