Latest #metaprogramming Threads Top

mudasobwa
Imagine a conductor forced to relearn musical notation every time a new instrument joins the orchestra. Violin—one system of writing. Cel...
New
mudasobwa
I’ve been heavily working with macros for more than 10 years already and I always used kinda ad-hoc code to expand/debug/test those when ...
New
ostap
In Phoenix apps, the web module provides this “re-dispatch into methods” technique for use (see __using__): defmodule ExampleWeb.Router ...
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
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

This Week's Trending Top

This Month's Trending Top

This Year's Trending Top

amalbuquerque
Hi there, After reading @ericmj response here (Using unquote outside of quote block - #6 by ericmj) about “unquote fragments”, I still c...
New
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
mudasobwa
I’ve been heavily working with macros for more than 10 years already and I always used kinda ad-hoc code to expand/debug/test those when ...
New
mudasobwa
Imagine a conductor forced to relearn musical notation every time a new instrument joins the orchestra. Violin—one system of writing. Cel...
New
ostap
In Phoenix apps, the web module provides this “re-dispatch into methods” technique for use (see __using__): defmodule ExampleWeb.Router ...
New

Last Three Year's Trending Top

notexactlyawe
I can’t seem to pass an anonymous function as an option to a Plug. I am using plug_hmouse which from the documentation takes an option di...
New
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
linusdm
After reading Metaprogramming Elixir, and the hexdocs on metaprogramming and macros, I was wondering how this ties into macros we use eve...
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
evancloutier
I’m in the process of creating some reusable test modules using a macro: defmodule SharedTestCase do defmacro define_tests(do: block) ...
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 value ...
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 ParamPipe ...
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
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
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
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 runt...
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