pepicrft
Feedback on my first macro-based library - Modulex
Hey folks ![]()
I implemented a library that uses macros extensively, and I’d appreciate feedback from people that are more versed at writing macros in Elixir. The library is application_module and I plan to use it with mocking libraries like Mox or Hammox to remove some boilerplate code and ensure consistency throughout the codebase.
I managed to get it working but it required a lot of try-and-error and through-ChatGPT learning to get it to a functional state so I wouldn’t be surprised if there’s a lot of room for improvement.
Thanks,
Pedro
Most Liked
krasenyp
Don’t “nest” modules under built-in modules. In your case it’s Application. It’s a bad practice and frowned upon when it comes to libraries like plug’s Plug, let alone the built-in Application module. I understand that ApplicationModule might be considered ugly but nodule names are just atoms so it doesn’t really matter.
Popular in RFCs
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








