[haXe] AS3 cannot handle properties?

edA-qa mort-ora-y eda-qa at disemia.com
Mon Jul 2 14:26:49 CEST 2007


I believe AS3 functions the same way in that it uses the getters an
setters with the appropriate names.

I have some code which uses this and it behaves the same way in Haxe
compilation and the Flex compiler (so somehow it must be working, at
least for setters)



Cons T Åhs wrote:
> Hi,
> when generating as3 from haXe I see the following.
> 
> haXe source:
>    public var x(getX, setX): String;
>     private function getX() {
>     return "x: " + x;
>     }
>     private function setX(s: String) {
>     x = StringTools.trim(s);
>     return s;
>     }
> 
> Generated as3 code:
>         public var x : String;
>         public function getX() : String {
>             return "x: " + this.x;
>         }
>         public function setX(s : String) : String {
>             this.x = StringTools.trim(s);
>             return s;
>         }
> 
> x has become a simple field, so accessing x will just return the value
> without the prefix generated by getX().  Is this a bug in haXe -> as3 or
> a bug in as3, ie, there is no corresponding construct in as3?  Easy to
> workaround by using getX() and setX(), but properties are very neat.
> 
> Regards,
> Cons
> 
> --haXe - an open source web programming language
> http://haxe.org
> 
> 


-- 
edA-qa mort-ora-y
Idea Architect
http://disemia.com/

Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://lists.motion-twin.com/pipermail/haxe/attachments/20070702/c0938fd4/signature.pgp


More information about the Haxe mailing list