simple Enum expr

46 views
Skip to first unread message

Benjamin Dubois

unread,
Feb 27, 2015, 1:29:56 AM2/27/15
to haxe...@googlegroups.com
I couldn't find out what is the correct ExprDef of an enum, a simple one at least (without parameters).

I eventually found out that there is an implicit match between
http://haxe.org/manual/expression.html
and
http://api.haxe.org/haxe/macro/ExprDef.html

For period of time I have believed any Haxe code but macro are expression.
Unfortunately I found Enum nowhere in the related pages, there must be a trick since enums are a key feature of Haxe.

So how do you match a simple enum in an expression switch ?

Juraj Kirchheim

unread,
Feb 27, 2015, 3:39:34 AM2/27/15
to haxe...@googlegroups.com
Enum constructors are basically just global functions (and read only variables) and are not represented any different. If this is unclear, look at the output of `trace(macro Some("value"))`.

Best,
Juraj

--
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.

Benjamin Dubois

unread,
Feb 27, 2015, 1:27:04 PM2/27/15
to haxe...@googlegroups.com
Thank you for the answer and for the debug tip.
I'll check that
Reply all
Reply to author
Forward
0 new messages