pepicrft

pepicrft

Feedback on my first macro-based library - Modulex

Hey folks :wave:

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

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.

pepicrft

pepicrft

This is a very good advise. I’ll rename it to ApplicationModule instead. I’m not entirely convinced about the name, but I can keep it until I can find something better. Thanks a lot @krasenyp.

Where Next?

Popular in RFCs Top

bennydreamtech23
So recently I have been looking for ways to improve my workflow in elixir and I saw all the commands I need to run to setup a project and...
New
UlrikHD
I’ve been wanting to write a library for the lemmy API so that I can port some of my scripts over to elixir. For those unfamiliar with le...
New
tiagodavi
I’ve just created and published my first Elixir library! Ex4j combines the power of Ecto schema with the Bolt protocol + an elegant DSL ...
New
miolini
Hi :waving_hand: I’ve been working on CanvasCraft, a 2D drawing library for Elixir built on top of Skia via Rustler. It provides a decla...
New
noizu
Hello, I wrote a more comprehensive llama_cpp nif wrapper noizu-labs-ml/ex_llama: (github.com) inspired by the unfortunately doa jereg...
New
puemos
Hey everyone :waving_hand: Code: GitHub - puemos/overbooked: Overbooked is a self-hosted flexible workplace platform for indie co-wor...
New
brettbeatty
At my work we build a lot of mix tasks for backfills and other maintenance tasks. Even with OptionParser we seem to copy a lot of boilerp...
New
ca1989
Hi all, this week I played a bit with Phoenix and Elm. I ended up with this POC: https://github.com/carlotm/elmex The repository cont...
New
Hedgehog-ai
Hello I would like feedback on an experimental neuroevolution (including substrate encoding) library called Bardo based on the amazing wo...
New
zachallaun
Note: There are a few folks I’d really love to hear from, time permitting. Pinging in case the title isn’t catchy enough :slight_smile: @...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

We're in Beta

About us Mission Statement