[haXe] New feature : Properties
Nicolas Cannasse
ncannasse at motion-twin.com
Thu Apr 13 10:13:19 CEST 2006
> Just some thoughts
>
> *) I will never ever set setter or getter private - since its just a
> different (not wrong) access its only good. (might be reasonable to
> change it maybe in documentation?)
I doesn't mean that you can't do it, I just wanted to show this point,
that the public-state of a property might be different from the
accessors ones.
I would say that's an user choice, to have methods hidden from the user.
For instance you might use a property and later replace it by a simple
public variable. In that case it makes sense to hide get/set methods
since they will not be needed anymore when you have a variable.
> *) What is about inheritance? Is a property used instead of a variable
> like:
>
> var a:MyType = new MySubType();
> a.x = 2 // x was a variable in MyType but is a setter/getter in MySubType
Properties are just special class variables, they are inherited and
can't be redefined in subtypes.
> *) How are properties represented within the reflect API - i cant see
> special methods for those in the API, and i cant find no description in
> the documentation.
Properties are also handled the same way variables are, except that in
the case of a getter/setter property, the var value will always be null.
Nicolas
More information about the Haxe
mailing list