Unquoute not working for maps even with Macro.escape

The options you receive are quoted but the default value isn’t quoted. So you could do this:

attrs = Keyword.get(options, :attrs, Macro.escape(%{}))

But it is better to avoid work outside of quote, so do this:

  defmacro __using__(options) do
    quote bind_quoted: [options: options] do
      require Logger
      @behaviour Esperanto.Parser

      @start_delimiter Keyword.get(options, :start_delimiter)
      @end_delimiter Keyword.get(options, :end_delimiter)
      @attrs Keyword.get(options, :attrs, %{})
3 Likes