From Haxe manual (
http://haxe.org/manual/class-field-property-rules.html) "Both getter and setter may access their physical field for data storage.
The compiler ensures that this kind of field access does not go through
the accessor method if made from within the accessor method itself,
thus avoiding infinite recursion:"
Is there a way to get separate access for setter and for physical field in any other place of code?
public var prop(default, set):Float;
public function new () {
prop = 10; // actually this is a set_prop(10);
// will be great to do this;
prop = 10; // not the set_prop(10) !
// but if we want call accessor
set_prop(10);
}
private function set_prop(v:Float):Float {
// here can be a lot of code of initialization, checks or/and access to other objects which can be null now
return prop = v;
}
Current solution for this - to use "get" instead "default" and declare "private var _prop:Float".