4 ms·
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 i
by lordgroff 6y ago
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.
- mycall 6y agoJava simply stole the show. It had GC, namespaces, huge ecosystem and free.
- mikewarot 6y agoLazarus 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.
- unnouinceput 6y agoWhen 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!
- lelanthran 6y ago> 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).
- vintagedave 6y ago> 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 Pascal isn't C. You can consume variadic methods written in a C library, but the Delphi way to write the same thing is an 'array of const'. Here's the Format method, for example: http://docwiki.embarcadero.com/Libraries/Sydney/en/System.SysUtils.Format http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Sy... > each little problem, surmountable on its own, adds to the overall friction when developing. You may have better luck not thinking of it from a C background but as similar to, say, Python: some things are different.
- beagle3 6y agoDo note Python recently gained a C like assignment operator, the “walrus” operator.
- lelanthran 6y agoNow, 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 no idea what you mean here, sorry. This explains the issue quite well: https://forum.lazarus.freepascal.org/index.php/topic,43622.msg305634.html#msg305634 https://forum.lazarus.freepascal.org/index.php/topic,43622.m... > Today, try using TFileStream. 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.