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

I actually went with Pascal(FPC) for my own self-learning in college, in the 2000's, even though I had some classroom exposure to C.

Pascal is just a little bit more polished in its syntax around data handling. The pass-by-reference syntax reduces reliance on pointers, and the Borland pointer syntax is sensible(reference vs dereference is indicated by ^ at left vs right) and helps to position pointers as an occasional tool rather than the essence of your program. Trying to teach C syntax involves a mandatory "OK kid, here is how we actually decipher what the * means here and why your program crashes when you try to dereference it" period. We know that it's bad - because everyone, at every level of skill, messes it up occasionally, and there's an inherent tendency in C to do a heap alloc wherever your algorithm needs it and then immediately manipulate it with pointers, instead of thinking through a way of designing it with bounded buffers. Likewise := is a better assignment operator than C =, because you might accidentally leave out the : and compare, but you'll never accidentally add a : and assign.

The downside of Pascal syntax relative to C is mostly in control flow, block structure, declarations being more verbose - it's something you can get used to, but it's that little bit harder to jump in and start hacking out something. With the extensions currently in FPC, I'd still prefer using it over C, though. It's a mature development environment, mostly hamstrung by an ecosystem that has fallen behind in favor of newer things.



Modula-2 was Pascal perfected to the point where it could do everything that C could do better and safer. Unfortunately, by then it was too late.




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

Search: