Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir/lib/kernel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3392,7 +3392,7 @@ defmodule Kernel do
Converts the argument to a string according to the
`String.Chars` protocol.

This is the function invoked when there is string interpolation.
This is the macro invoked when there is string interpolation.

## Examples

Expand Down
12 changes: 12 additions & 0 deletions lib/elixir/lib/kernel/special_forms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,18 @@ defmodule Kernel.SpecialForms do
...> end
{:sum, [], [1, 2, 3, 4, 5]}

Also can be used in block context, outside of function arguments.
Though, it is still required to be wrapped into parentheses.

iex> requires = for module <- [Integer, Logger] do
...> quote do
...> require unquote(module)
...> end
...> end
iex> block = quote do: (unquote_splicing(requires))
iex> Macro.to_string(block)
"require Integer\\nrequire Logger"

"""
defmacro unquote(:unquote_splicing)(expr), do: error!([expr])

Expand Down