How objects with fields which are haxe keywords should be defined?


(Alexander Djafarov) #1

For instance how define such objects {default: true} or {in: true}?
Is it possible to give an alias for a typedef field?

(Fran├žois Barbut) #2

I would use Reflection to do this

(Rudy Ges) #3

@:native (on extern types) can help:

(Alexander Djafarov) #4

Thanks. But Dynamic is not very elegant solution. What if you need define the object {field1: Bool, field2: Bool,..., fieldN: Bool, default: Bool}?

(Alexander Djafarov) #5

Thanks for reply. But the code compiles to var o = new MyType(true,false);, but I need output like this var o = {default: true, in: false}

(Dmitry Hryppa) #6

Is something like this will help?

(Aleksandr Kuzmenko) #7

Use double quotes for such fields: {"default":true, "in": false}

(Alexander Djafarov) #8

Yep, using of abstract can solve this issue. Thank you.

(Dan Korostelev) #9

FWIW, this proposal, once implemented should address this nicely.