On 02/27/2014 04:35 PM, Jonas Maebe wrote:

You have to declare an instance and then call its property. You don't have to instantiate the instance if the property maps to a class method.

Technically there's some obstacle to allow such construct?

Class properties should be accessible from within static class methods. Having them accessible depending on the getter/setter they use (static or not) would break orthogonality (the visibility/usability must depend on the interface, not on the implementation of the interface).

I just came across the same issue and as well got the error "Only class methods, class properties and class variables can be referred with class references".

Hence I cant do "TmyClass.myProperty:=xyz;"
but I _can_ do "TmyClass.SetmyProperty(xyz);"
I in fact directly calling the "class" function that is denoted in the definition of the property.

Hence: I am allowed to use a class variable instead of a property, and I am allowed to call the setter class function, but I am not allowed to use the syntax candy provided by the property keyword.

In fact I don't see why this should make sense.


The error message suggest that it should be possible to define a "class property" similar to a class function. But this syntax seems to be illegal (says the appropriate error message).


-Michael
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to