Pascal to this day remains one of the most readable languages around. It's not fancy, it's verbose, and very clear. I think the only reason it fell from grace is the simple fact that it came from an era when best implementations of it were commercial, and that's not something that is acceptable in this day and age.
> I think the only reason it fell from grace is the simple fact that it came from an era when best implementations of it were commercial, and that's not something that is acceptable in this day and age.
I love Lazarus, and Delphi before it, and Pascal before that ... but I gotta say, the language, readable though it is, is a pain in the rear to write.
An instance of a class is not the same thing as an object.
By default, the file open/read/write/close routines don't return error values so the caller has to do extra work to check statuses after each use of these functions (IIRC, those error codes from Assign(), Reset(), etc weren't thread-safe either!)
Some conditional expressions cannot have parenthesis (compilation error) while other conditional expressions must have parenthesis (also a compilation error).
Some builtin functions can't be easily 'wrapped' because while the function may take variadic arguments, the language doesn't allow the programmer to write variadic argument functions.
It's death by a thousand cuts; each little problem, surmountable on its own, adds to the overall friction when developing.
What I really like in Pascal:
1. Programmer-defined range types: enums are not a replacement for those.
2. Bounds checking on arrays; I'd rather crash with an exception than silently overrun the array.
3. Nested functions (although, now with almost all languages supporting anonymous functions nested functions probably aren't really needed).
> An instance of a class is not the same thing as an object.
I have no idea what you mean here, sorry.
> By default, the file open/read/write/close routines don't return error values
Those file IO methods are for backwards compatibility with Turbo Pascal. They haven't changed semantics since DOS. They don't support Unicode. They are heavily deprecated. Today, try using TFileStream.
> while the function may take variadic arguments, the language doesn't allow the programmer to write variadic argument functions
Now, granted, my knowledge on Pascal, Delphi and Lazarus is qite old and I've not used any of them for a long time, so if I'm making errors in anything I say below, then please accept my apologies in advance :-)
>> An instance of a class is not the same thing as an object.
I have used it and was not as unhappy with it as I was with the Standard Pascal file IO functions. I was never able to figure out from the exception why a TFileStream method failed. The most you could infer was that an error occurred, but not what error.
This makes for a very poor interface to the user in the resulting application, as they have no idea what to do to fix the error before retrying. In most other languages (that Delphi and Lazarus compete with) you can let the user know what they should do to fix the error before retrying.
> You can consume variadic methods written in a C library,
That doesn't apply to what I was saying. I meant that a programmer could not write a Pascal procedure that wrapped a variadic-args Pascal procedure. C has nothing to do with this.
This is occasionally useful (say, for logging), and its ommission is one of those tiny things that add friction.
With all that being said, I still prefer doing native GUI apps in Lazarus to almost everything else out there. It's insanely readable even after a prolonged period.
I am not sure how Lazarus implements stuff behind the scene but I can tell you 100% for sure that in Delphi every declared class has TObject as ancestor class, so when you instantiate a class in Delphi, you are creating an object.
> I am not sure how Lazarus implements stuff behind the scene but I can tell you 100% for sure that in Delphi every declared class has TObject as ancestor class, so when you instantiate a class in Delphi, you are creating an object.
Like I said, my experience is quite old (circa 2004 with Delphi), but last I used Delphi, it functioned identically to the way that link for Lazarus said it did.
You could create your own class, then instantiate it, and what you got was different from creating an instance of an object.
Lazarus doesn't have GC, but strings are handled by automatic reference counts, and everything complex is an object with create/delete, so manual memory management isn't really a chore.
There is a hierarchical namespace based on units, and also there is lexical scope.
When I first tried Java, 25 years ago, after learning Pascal/C/C++ at Uni first, my first pet-peeve with it was the fact that I could not declare global variables. Coming from Pascal and C/C++ that was a bummer. I had to declare a class then inside that class go declare my global variables. Imagine my frustration that instead of just typing "globalHandle = 25" I had to write instead "mumuClass.globalHandle = 25". Real productivity bump right there!