[haXe] AS3 cannot handle properties?
Cons T Åhs
cons at uplayme.com
Mon Jul 2 16:13:14 CEST 2007
On 2007 jul 02 , at 15:30, Hudson Ansley wrote:
> AS3 does not allow return values on setters. So, maybe if your haXe
> code was:
>
>
> public var x(getX, setX): String;
> private function getX() {
> return "x: " + x;
> }
> private function setX(s: String) {
> x = StringTools.trim(s);
> }
>
> it would equivalent to this in AS3:
>
> private var _x:String;
> public function get x(): String {
> return "x: " + x;
> }
> public function set x():void {
> x = StringTools.trim(s);
> }
>
> have not tried this, and I'm really not sure what haXe --> AS3 does
> with the private var name of a getter/setter. Just speculating since
> there is no way to actually use AS3 getter/setters to accomplish your
> haXe code because of the setter return value.
It seems that there a requirement that the setter return a value as
well, but this is not the major problem. In my original code (that I
didn't post) U actually did not have any setter at all, only a
getter. It generated the code I included, which has different
semantics than in haXe.
From your example above, I conclude that AS3 does support setters
and getters defined by a rather obscure syntax, ie, a "name" with
spaces in it. If that indeed is the case, it seems to me that the
haXe -> AS3 conversion has room for some improvement.
Am I misreading something?
Cons
More information about the Haxe
mailing list