Haxe Notes For ECMA Coders: Object Literal Notation

98 views
Skip to first unread message

Jeff Ward

unread,
May 16, 2015, 5:54:22 PM5/16/15
to haxe...@googlegroups.com
I wrote a post about Haxe object literal notion from the perspective of an EMCAScript (JS/AS3) hacker:

http://jcward.com/Haxe+Notes+For+ECMA+Coders+Object+Literal+Notation

Feel free to comment, suggest, correct, or otherwise politely engage in discourse!  Hopefully someone finds it helpful.

Best,
-Jeff

wighawag

unread,
May 17, 2015, 4:21:17 AM5/17/15
to haxe...@googlegroups.com
Nice post, there is haxe.DynamicAccess (http://api.haxe.org/haxe/DynamicAccess.html) who do mostly what you want. I discovered it after doing something similar myself :)

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Timothy Farrell

unread,
May 18, 2015, 12:23:45 PM5/18/15
to haxe...@googlegroups.com
For your example at http://try.haxe.org/#F1bA1

You could use Object.keys() for a little speed boost (keeping in mind that it doesn't do exactly the same thing)...

    public inline function keys():Array<String> {
#if js
        return (untyped Object).keys(this);
#else
        return Reflect.fields(this);
#end

Jeff Ward

unread,
May 18, 2015, 4:41:30 PM5/18/15
to haxe...@googlegroups.com
Thanks for the suggestions! I'll make some updates to the post soon.

Best,
-Jeff
Reply all
Reply to author
Forward
0 new messages