News for hackers. Stuff that matters.
Re:50 Years of Pascal and Delphi Is in Power by vintagedave on Saturday April 03, 2021 @02:01PM (#26683174)
> 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.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.

Re:50 Years of Pascal and Delphi Is in Power by lelanthran on Saturday April 03, 2021 @02:54PM (#26683669)
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 no idea what you mean here, sorry.

This explains the issue quite well: 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.

Re:50 Years of Pascal and Delphi Is in Power by unnouinceput on Saturday April 03, 2021 @03:18PM (#26683875)
Quote: ">> 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.m..."

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.

Re:50 Years of Pascal and Delphi Is in Power by lelanthran on Sunday April 04, 2021 @10:12AM (#26689528)
> 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.

Re:50 Years of Pascal and Delphi Is in Power by beagle3 on Saturday April 03, 2021 @02:15PM (#26683312)
Do note Python recently gained a C like assignment operator, the “walrus” operator.