On Sat, 16 Dec 2023, Hairy Pixels via fpc-pascal wrote:
On Dec 15, 2023, at 8:56 PM, Adriaan van Os via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:
What complicates things, is that many conflicting rules have the same name in
the Language Reference. For example, conceptually we have object-methods,
record-methods, class-methods, interface-methods and objcclass-methods. But
only the record method rules are prefixed as such.
You mean like why records require you to add "static" to class methods? Makes
no sense to me either.
Well, I guess the explanation is something like the following:
Because class methods normally get a TClass pointer (a class reference) as Self
unless you
specify self (in which case they become normal records).
Since records do not have a TClass concept, this 'Self' cannot be passed.
To be consistent with classes and to make this explicit, the 'static' is
required.
In my opinion this is superfluous, but embarcadero decided otherwise.
The requirement for parameters in record constructors I guess comes from C++ builder by Embarcadero.
There are some limitations imposed by C++.
Whether they could be dropped in FPC is something Sven Barth should answer.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal