Any good tutorials on macros in Haxe?

I’ve seen the official snippets on the Haxe website.

What I’m trying to do is have a macro function that can take a list of interfaces, IUserService, etc and generate REST routes automatically for my web server, SideWinder. In that case I need to pass a list of interfaces and be able to detect methods that include Metadata, detect parameters for the methods, and then do something with that (generate code that automatically receives get, post, etc and calls a instance of a class that implements the interface).

Any help is appreciated.

You can mark your interfaces with @:autoBuild and it will add @:build meta to all classes that implement them, maybe this can be good enough for you? Then in linked macro you can get fields of these classes and do things.

Thank you, I will take a look at @autobuild

Here is the example of function generating with @:autoBuild of a base class. You can do a similar thing with an interface.

Ah, this is perfect, thank you! I will jump in and see if I can get it to work.

I love the idea of macros in Haxe but just need to actually spend some time learning it.

I may be back with specific problems, haha, but this should put me on the right track.

Also there are some good Haxe macro repositories here: