Latest #metaprogramming Threads 
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
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
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
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
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
Warning: Calling this function inside a macro is considered bad practice as it will attempt to evaluate runtime values at compile time. M...
New
In file 1:
defmodule Utils.Struct do
# this is for importing definitions when "use Utils.Struct" is called
defmacro __using__(_opts...
New
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
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
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
This Month's Trending
This Year's Trending
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
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
Can Elixir code detect whether it is executing at compile time? I would like to write something like the following macro:
defmacro foo()...
New
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
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
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
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
I am trying to hook into the @doc deprecated: "message" annotation using __on_definition__.
defmodule ExampleCompiler do
def __on_defi...
New
I’m developing a Supabase client for Elixir with complete support for all their services, like:
storage
auth
realtime
UI (live view)
S...
New
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
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
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
With the following code:
defmodule Foobar do
defmacro b(arg) do
arg
|> String.split("\n")
|> IO.inspect()
end
d...
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
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
I’m accessing module attributes at compile-time and no guarantee on module compilation state. So I wrote the following:
case Code.ensure...
New
I want to work on a DSL that looks very similar to unit tests, define some steps but the steps are linked
step "step 1" do
IO.puts("...
New
Trending Over Three Years
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
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
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
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
parameterized pipe in elixir: |n>
edit: negative index in |n> and mixed usage with |> are supported
example:
use ParamP...
New
Hi community!
What is the correct way to implement the __using__ macro with an option that changes the way generated functions behave? O...
New
Hi everyone, I was toying around with macros today and I reached a stagnation point. After trying multiple approaches I started to think ...
New
I'm trying to do something similar to wath ecto does when defining schemas. Basically the idea is:
defmodule Test do
use TableBuilder...
New
I have three identical methods in my module, that do (almost) exactly the same thing. Instead of repeating the function definitions, I am...
New
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
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
I want to programmatically generate input objects from introspecting my schema, but I can’t figure out the metaprogramming to do so.
Ess...
New
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
defmodule Bar do
@after_compile __MODULE__
defmacro __before_compile__(_env) do
IO.inspect("#{__MODULE__}.__before_compile__")
...
New
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
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
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #ash-questions
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #exunit
- #discussion
- #javascript
- #elixirconf
- #library
- #oban-questions
- #dialyzer
- #docker
- #onsite
- #authentication
- #podcasts
- #full-time-contract
- #umbrella
- #code-sync
- #ecto-query
- #phoenix_html
- #iex
- #graphql
- #genstage
- #elixir-ls
- #nerves-questions
- #podcasts-by-brainlid
- #supervisor
- #websockets
- #distillery
- #advent-of-code
- #blog-post
- #livebook-questions
- #processes
- #forms
- #api
- #metaprogramming







