Didn’t know about quote until now. Seems super useful, thanks!
That explains the ArgumentError:
iex(84)> x = "a"
"a"
iex(85)> quote do: "bb#{x}"
{:<<>>, [],
[
"bb",
{:::, [],
[
{{:., [], [Kernel, :to_string]}, [], [{:x, [], Elixir}]},
{:binary, [], Elixir}
]}
]}
iex(86)> quote do: x|> "bb#{}"
{:|>, [context: Elixir, import: Kernel],
[
{:x, [], Elixir},
{:<<>>, [],
[
"bb",
{:::, [],
[
{{:., [], [Kernel, :to_string]}, [], [{:__block__, [], []}]},
{:binary, [], Elixir}
]}
]}
]}
Basically #{} expects an argument to be passed in, but we are not passing anything to #{} when we do x |> "bb#{}". But "bb#{x}" does.