This is clever, thanks for the reply.
What I had in mind (my second idea) was something slightly simpler:
defmodule Prefixes do
defmacro prefix, do: "foo"
end
defmodule Usage do
import Prefixes
def something(prefix() <> rest), do: rest
end
I like this a bit more because I think the syntax is less surprising. It looks almost exactly like a module attribute except it can be used anywhere, plus it’s discoverable.
One thing I was wondering is: does anyone know whether this would have any performance impact (at least at compile time)? I would think it would be insignificant.






















