[fpc-devel] "referenced properties" vs "value properties"
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Wed Sep 21 12:45:21 CEST 2011
Skybuck Flying schrieb:
> I think the Delphi language has a little problem when it comes to
> "properties".
>
> I consider C/C++ to be a "value language" or maybe even a "const language"
> where addresses of classes and fields are constant or hard coded into
> instructions.
>
> While Delphi is more of a "reference language" or "pointer language" where
> addresses of classes are stored in data pointers which are used via
> instructions.
A closer look will reveal that references had to be introduced into the
C++ language, in order to make operators work with certain data types
(arrays...).
> The closest thing to a c++ class is a record in Delphi.
Closest comes the Object type, but Borland/CodeGear decided to drop that
useful type, and moved part of its features into records (methods...).
FPC still supports Object very well.
> The problem with properties currently is that it does not allow partial
> modification of records or arrays
That's due to the (possibly) virtual getters/setters, which make
properties a really useful language feature. If you want references,
then use data fields (var) instead of properties.
> The operators themselfes do not seem to work with pointer types, so
> pointers
> will have to be deferenced, quite a mess.
See C++.
DoDi
More information about the fpc-devel
mailing list