[haXe] User of flash.utils.Dictionary or alternative for Weak
references
Nicolas Cannasse
ncannasse at motion-twin.com
Fri Aug 3 12:59:51 CEST 2007
edA-qa mort-ora-y a écrit :
> Nicolas Cannasse wrote:
>> Looks like __keys__ returns keys coerced to strings (maybe due to ForIn
>> opcode usage ?). It might then not be possible to iterate over
>> Dictionary keys. Do you have a working AS3 sample ?
>
> I did an experiment and converted to AS3 first and then compiled and the
> iteration over the dictionary works as expected. So it can work, but
> direct compilation fails. That is, hx=>SWF produces code which doesn't
> work, hx=>AS3=>SWF produces code which does work!
>
> Though in your => As3 conversion you do attempt to force the keys into
> Strings:
>
> $r = new Array();
> for(var $k : String in listeners) $r.push($k);
> return $r;
>
> Apparently AS3 doesn't actually convert as these are the original
> intended type.
>
> I'll look a bit further, but perhaps you can check the __keys__ code and
> see if the compilation is somehow forcing conversion to string.
I have doublechecked and try to see differences between the decompiled
AS3 and haXe code. I don't understand why there is this difference since
there is no cast to String done in __keys__ code (check genswf9.ml lines
970-991 if you find something).
Nicolas
More information about the Haxe
mailing list