Latest #macro Threads 
For those of us still caring about the code readability (in the age of LLMs), this tiny library can replace nested ifs in situations when...
New
I have a macro that expands into a module definition. The use case is that we take a testcase defined in one elixir module (parent) and m...
New
Hi,
I am wondering thy elixir added parens at the end not just simply changed \* to + and + to \*
Interactive Elixir (1.19.1) - press C...
New
There is an example in Ash Framework of adding a resource Album into Music domain
mix ash.gen.resource Tunez.Music.Album --extend postgr...
New
As the title says: is it possible to verify that a parameter to a macro is a typespec? As I understand it, a macro receives the ASTs as p...
New
Hello, so I was wondering if something like newtypes is possible in Elixir and found something that does it but I THINK (correct me if I’...
New
Recently I was in a conversation with José Valim where I happened to mention that I find myself writing code like this:
X = if COND, do:...
New
I am trying to write custom logger , as I am tired of writing Logger.xyz() and then interpolate and inspect some variable.
Trying to ach...
New
I’m working on a macro to support automatic timing for functions.
If I have this - say:
def double(x) do
x + x
end
I would like to b...
New
In order to only have one branch of code in a macro that defines functions with support for guards, I would like to always have a guard. ...
New
This Week's Trending
This Month's Trending
This Year's Trending
I have a macro that expands into a module definition. The use case is that we take a testcase defined in one elixir module (parent) and m...
New
There is an example in Ash Framework of adding a resource Album into Music domain
mix ash.gen.resource Tunez.Music.Album --extend postgr...
New
Hi,
I am wondering thy elixir added parens at the end not just simply changed \* to + and + to \*
Interactive Elixir (1.19.1) - press C...
New
Last Three Year's Trending
I need to access the application name under which a module was defined, in other words, I need the name defined in the module’s parent mi...
New
Can Elixir code detect whether it is executing at compile time? I would like to write something like the following macro:
defmacro foo()...
New
Hello friends,
I want to create a module inside another module with an atom name:
For example:
defmacro sub_field(name, _type, opts \...
New
Is there any way to override functions generated by a use macro when those functions have NOT been tagged as defoverridable?
I’m tapped ...
New
I have a question regarding a code snippet from part 6 of a really great Macros guide by @sasajuric.
This question specifically ranges f...
New
Hex: bin_struct | Hex
Git: GitHub - 4ait/bin_struct · GitHub
Docs: bin_struct v0.2.34 — Documentation
BinStruct is a library which mai...
New
I’m working on a macro to support automatic timing for functions.
If I have this - say:
def double(x) do
x + x
end
I would like to b...
New
Summary
I’m trying to create a macro that takes in input a module name and automatically creates a defdelegate for each function defined ...
New
Hello friends, I do not think this problem of mine exists in production build ( I did not test it), but in developer mode iex -S mix.
im...
New
I have this weird behaviour with quoting n in iex. (1.14.3-otp25 on mac)
iex(1)> ast = quote(do: n)
{:n, [if_undefined: :apply, conte...
New
In order to only have one branch of code in a macro that defines functions with support for guards, I would like to always have a guard. ...
New
Hi!
I’m trying to avoid redundant testing (that means, tests that are made in the same way all the time but with slightly different para...
New
I am currently stuck in implementing a macro :thinking: Here’s the code I currently have (without unnecessary code):
defmacro request(op...
New
I’m wondering if the following is possible:
I have an application where I would like to parse boolean expressions and produce correspond...
New
I am trying to write custom logger , as I am tired of writing Logger.xyz() and then interpolate and inspect some variable.
Trying to ach...
New
Trending Over Three Years
defmodule Bar do
@after_compile __MODULE__
defmacro __before_compile__(_env) do
IO.inspect("#{__MODULE__}.__before_compile__")
...
New
Suppose we’ve got the following module:
defmodule TestModule do
defmacro test_macro(param1, param2, param3) do
quote do
para...
New
I’m having a bit of trouble wrapping my brain around how I would pass a dynamic fragment to ~p inside a macro:
defmacro __using__(opts) ...
New
Background
So, I am playing around with a concept named “NewType” and I am taking inspiration from languages like F# and Scala.
My objec...
New
This is my first time I am looking at macros. I think I understand they are something like “pre generation” of code. Maybe something li...
New
Summary
Is there any way to write a function which can be invoked in compile time and which can return an AST and Macro.Env of given func...
New
Hello, I want to load a alias under my __using__, but with opts help like this:
defmacro __using__(opts) do
quote(bind_quoted: [opts: ...
New
Hey,
I’m currently trying to DRY up some tests which have a lot of boilerplate code in the form of:
test "user is updated", %{user_id: ...
New
Is there a way to put more functions into __using__ block? It gets very long and hard to read. I cannot figure out how to split up the ...
New
Hello there,
I have the following scenario:
I have a library my_lib that is used in my_app. my_lib has a configuration file option that...
New
For a library, we get the list of all Ecto Schema modules of the user’s app, and want to generate functions (through macros) into a modul...
New
How can I create a macro that defines a type using atom that represents the type name? In the macro __type__ below, for the visibility a...
New
Hi everyone!
I’m searching for a hint for a problem I cannot understand if it is in my code or a third party misbehaviour.
I’m currentl...
New
I’d like to use the ~E sigil inside of a macro. For some reason the assigns variable is not accessible:
defmacro __using__(_opts) do
q...
New
Hi friends, I have a nested list that is unstructured, and I really know how much it has nested list or map in itself.
I just need to se...
New
- Follow
- Join
- Shape
the conversation
Latest on Elixir Forum
Get money off!
The Pragmatic Bookshelf
35% off any eBook
Manning Publications
45% off any item
ElixirCasts
10% off for life
The Pragmatic Studio
20% off any course
AppSignal
10% off for 12 months
Honeybadger
10% off for 12 months
Simply use coupon code "devtalk.com" or "elixirforum" at checkout!
Filter by Type:
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
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









