[haXe] New feature : Properties
Nicolas Cannasse
ncannasse at motion-twin.com
Fri Apr 14 10:25:31 CEST 2006
> Properties are just special class variables, they are inherited and
> can't be redefined in subtypes.
>
>
> THAT is a problem! Because what if you want to implement some
> interface that requires a property a but like to extend a class that
> already defined (for internal uses, that you cant change, because its
> precompiled or closed source) this variable?
In that case, there is an error, saying that the field has incorrect
access (this can be "public" in interface and "private" in class, or
"var" in interface and "property" with getter/setter in class -- or the
other way since you can declare properties in interfaces).
The point is, it does make sense to have it this way, please remember
that properties in haXe are compile-time features and not runtime ones
(because runtime properties are not handled on all platforms). Then when
you have a class with a property x(getX,setX), and an interface with a
var x, you can't compile the field access to this.getX() or this.x at
the same time, the compiler need then to ensure that all accesses are
coherent.
> Why don't you implement a more detailed output ... that contains
> informations about if the variable is setable/getable ... ?
I don't understand this question :)
Nicolas
More information about the Haxe
mailing list