Latest #metaprogramming Threads Top

waseigo
I saw this LinkedIn post: *Can your programming language do this? This is a macro in Clojure called `dotrace`. When you surround a pie...
New
skyqrose
What’s the type to use for a function that returns a quote? For example: @spec f() :: what_goes_here def f() do quote do code e...
New
AppleKid7
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
lkuty
I have a module for which I want to create a function rule_ids/0 at compile time. The code collects the rule ids at compile time from the...
New
roflbobl
I have a problem, where i have a macro the calls another function. I want to be able to add optional guards to my macro, and call the nes...
New
Eiji
Warning: Calling this function inside a macro is considered bad practice as it will attempt to evaluate runtime values at compile time. M...
New
Oliver
In file 1: defmodule Utils.Struct do # this is for importing definitions when "use Utils.Struct" is called defmacro __using__(_opts...
New
budgie
I’m trying to unquote multiple blocks of code dynamically depending on the include option passed when use is called. When I try to map ov...
New
axelson
I’m playing around with creating a rather unidiomatic testing library and I’d like to constrain a macro call of a macro that my library e...
New
igorb
Hello all! Announcing Fireside, a tool to install and upgrade code templates that are themselves Elixir apps. Fireside allows you to br...
New

This Week's Trending Top

This Month's Trending Top

This Year's Trending Top

lud
Hello, I just extracted the boilerplate management code that I used to work with in previous years: It is yet another generic input d...
New
waseigo
I saw this LinkedIn post: *Can your programming language do this? This is a macro in Clojure called `dotrace`. When you surround a pie...
New

Last Three Year's Trending Top

addrummond
Can Elixir code detect whether it is executing at compile time? I would like to write something like the following macro: defmacro foo()...
New
cjbottaro
I know this has been asked before, but I still can’t get it to work. I have code like this… def case_stmt(input) do [c1, c2, c3, c4] =...
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
jeroenbourgois
I would like to add a function to my project that is available throughout all modules without aliasing/importing it. How should I go abou...
New
lud
I’m trying to build a protocol and a test suite to implement different adapters (impls of the protocol). I tried to use a CaseTemplate, ...
New
arjan
I am trying to hook into the @doc deprecated: "message" annotation using __on_definition__. defmodule ExampleCompiler do def __on_defi...
New
zoedsoupe
I’m developing a Supabase client for Elixir with complete support for all their services, like: storage auth realtime UI (live view) S...
New
christhekeele
I’m doing some questionable meta-programming, and could use your help! I’m using Macro.prewalk to traverse some source code, with the go...
New
apoorv-2204
I have a module utils,which is supposed to be used by MOdule A, B,C,D… and so on. The issue is utils modules have lot of constants, const...
New
zoedsoupe
I’m not very used to macros/compile time manipulation, but I will explain what I want to achieve and would like to know if it’s possible ...
New
gavid
I have a system that has thousands of run-time generated modules, some of which I want to cache for future reloading. Ordinarily, the BE...
New
rcm765
With the following code: defmodule Foobar do defmacro b(arg) do arg |> String.split("\n") |> IO.inspect() end d...
New
Sebb
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
PID_ONE
I’m trying to write a couple of mix format plugins for my project. So far I’ve been able to achieve most of what I want (e.g. rewriting f...
New
rcm765
I’m accessing module attributes at compile-time and no guarantee on module compilation state. So I wrote the following: case Code.ensure...
New

Trending Over Three Years Top

valyukov
Hi there, How I can build queries with dynamic fields assignment in Ecto? I try to do next thing: import Ecto.Query field = :id val...
New
augnustin
Hi, I have been coding with Elixir for 9+ months and I encountered several time the concept of quotes and each time, I think “ok, today ...
New
svilen
I have a bunch of functions in a module, that I’d like to dynamically add to a __using__ macro: defmodule A do defmacro __using__(_opt...
New
eksperimental
I’m improving some documentation in Elixir, and in order to do so, I need to dynamically build a list of atoms, but without using string...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamP...
New
mruoss
Hi community! What is the correct way to implement the __using__ macro with an option that changes the way generated functions behave? O...
New
thiagomajesk
Hi everyone, I was toying around with macros today and I reached a stagnation point. After trying multiple approaches I started to think ...
New
matteosister
I'm trying to do something similar to wath ecto does when defining schemas. Basically the idea is: defmodule Test do use TableBuilder...
New
sheharyarn
I have three identical methods in my module, that do (almost) exactly the same thing. Instead of repeating the function definitions, I am...
New
lakret
I’m struggling with overriding hygiene during manual manipulation of AST with Macro.postwalk. In short, I want to provide a syntax for in...
New
AndyL
Elixir newbie here working on a stemmer for a document indexing engine. The stemming algorithm has dozens of steps with many tests per s...
New
cjbottaro
I want to programmatically generate input objects from introspecting my schema, but I can’t figure out the metaprogramming to do so. Ess...
New
tangui
Hi all, I’ve been playing with Specify lately and I’m trying to get the @type module attribute like the @doc one, so as to link to that ...
New
thojanssens1
defmodule Bar do @after_compile __MODULE__ defmacro __before_compile__(_env) do IO.inspect("#{__MODULE__}.__before_compile__") ...
New
cjbottaro
Easiest to ask this in code... defmodule Foo do use Tagger tag(:red) end defmodule Bar do use Tagger tag(:blue) end Then at ...
New
  • Follow
  • Join
  • Shape
the conversation

Latest on Elixir Forum

Elixir Forum

Similar Portals

    None added yet

We're in Beta

About us Mission Statement