postite / citruxengine

6 stars 2 forks source link

Syntaxic stuff #3

Open postite opened 12 years ago

postite commented 12 years ago

The main things about translating to haxe:

After batching files with as3hx , the tool makes a good translation but is having issues.

  1. It translates Objects to dynamics but does not translate field access. Obj["prop"]=value is translated to dyn["prop"]=value but it has to be Reflect.setField(dyn,"prop",value) And value =obj["prop"] to reflect.field(dyn,"prop")
  2. Dictionary is not handled by nme We have to pass through another datastructure Maybe objecthash.
  3. Casting As3hx generates try catch for casting I had to get rid of them for gestouch because it was not compiling.

4.Lambda Most of time we have to move array.indexof. To lambda.indexof(array,item)

5.boolean null In as3 we acn check if an instance is not null by doing: If (instance) It does not work in haxe . But if( instance!=null) yes.

6.Classes Have to replace getdefinitionbyname by type.getclass And createinstances stuff

And so on...

alamboley commented 12 years ago
  1. the hash tables seems to be the solution, great article there : http://lab.polygonal.de/?p=1325 We may use the polygonal library.
postite commented 12 years ago

yep but it is quite big as a third party ...

look here for a simple Dictionary alternative https://github.com/postite/Gestouchx/blob/master/Source/org/gestouch/utils/ObjectHash.hx