Dynamically generate aliases

Flailing around, trying to dynamically generate aliases (exploration stuff, purpose is discovery not necessity).

Is there any way the following code can possibly working without having to define another module and perform a use statement?

defmodule Things.Football do
  def bop(), do: :ok
end

defmodule Metaprogramming.Aliases.Attempt do
  Code.eval_quoted(
    quote do
      alias Things.Football
      __ENV__
    end
  )

  def that_changeset(), do: Football.bop()
end
1 Like