title: Invoke a private macro within a quote block
body: <p>I'm trying to invoke a private macro, within a quote block, using a variable defined within the code block itself.
  This is the pseudo-code showing what I would like to do (doesn't work)</p>
  
  <pre><code>defmodule Foo do
    defmacrop debug(msg) do
      quote bind_quoted: [msg: msg], do: IO.puts(msg)
    end
  
    defmacro __using__(_) do
      quote do
        def hello do
          my = "testme"
  
          unquote(debug(quote do: my))
        end
      end
    end
  end
  
  defmodule Bar do
    use Foo
  end
  
  Bar.hello()
  </code></pre>
  
  <p>And this would get converted (in my mind), at compile time to:</p>
  
  <pre><code>defmodule Bar do
    def hello do
      my = "testme"
      IO.puts(my)
    end
  end
  </code></pre>
  
  <p>Is there any way to achieve this? I'm struggling to find any documentation related to it.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I discovered that:</p>
  
  <pre><code>defmodule Foo do
    defmacrop debug() do
      quote do: IO.puts("hello")
    end
  
    defmacro __using__(_) do
      quote do
        def hello do
          my = "testme"
  
          unquote(debug())
        end
      end
    end
  end
  </code></pre>
  
  <p>Gets properly converted to what I need, but I'm struggling find a way to pass the variable as is, so that it becomes <code>IO.puts(my)</code></p>