Haxe 3 "bind" function is not expanded before macros?

41 views
Skip to first unread message

Andreas Söderlund

unread,
Jun 9, 2013, 12:02:26 PM6/9/13
to haxe...@googlegroups.com
Hello, I've noticed that when using the new bind feature, the generated function is not accessible from macros, it seems to be created after macro processing. I need access so I can modify it based on its closure. Any way to do this?

/Andreas

Simon Krajewski

unread,
Jun 9, 2013, 12:19:02 PM6/9/13
to haxe...@googlegroups.com
If you have control over the call-site, you can invoke the macro like so:

using YourMacroClass;
...
"foo".bind.yourMacroFunction();

Otherwise you could open an issue. I suppose we could add a
roundtrip-function to haxe.macro.ExprTools.

Simon

Andreas

unread,
Jun 9, 2013, 2:45:36 PM6/9/13
to haxe...@googlegroups.com
2013/6/9 Simon Krajewski <si...@haxe.org>
Am 09.06.2013 18:02, schrieb Andreas Söderlund:

Hello, I've noticed that when using the new bind feature, the generated function is not accessible from macros, it seems to be created after macro processing. I need access so I can modify it based on its closure. Any way to do this?

If you have control over the call-site, you can invoke the macro like so:

Unfortunately not, the macro will be used in a library so I'd like to avoid introducing a special case. Quite easy to forget (already done it a few times!)
 
Otherwise you could open an issue. I suppose we could add a roundtrip-function to haxe.macro.ExprTools.

I'll do that. How would that roundtripping work, btw?

Simon Krajewski

unread,
Jun 9, 2013, 3:00:59 PM6/9/13
to haxe...@googlegroups.com
It would type the expression, then convert it back to untyped AST.

Simon
Reply all
Reply to author
Forward
0 new messages