Top Ten Macros!

Anyone like to share their favourite macro?

If possible, for general language use - not a specific library or framework (does Phoenix use macros to ape Rails? I have zero Rails knowledge, and put my struggles with Phoenix syntax down to this - perhaps unfairly)…

It would be super interesting to see the neat ways in which users are evolving Elixir.

Perhaps we could compile them up into a utilities library? maybe someone has already done this though…

Also, a simple self contained complete example would be nice, along with the macro : )

1 Like

Well a big set is the libraries that expede has made, type_class and others are all awesome. However those libraries are made not so much to extend the language but more to add missing functionality.

For cool macro’s, well there are a variety of Ok and pipe and pit and other macro’s on hex.pm, all of those are useful and cool. Vic’s happy_path is a more capable with from before the modern with (I wish with added in the else handler that was a fallback to the else block, as well as tags).

And of course who can forget about oop! :wink:

Still so many more, I’m looking forward to the list. I’d say for third-party macro’s that type_class is wonderful, especially its testing methods.

3 Likes