No because interpolation uses the Strint.Chars protocol that defines a
different behavior for nil while Atom.to_string keeps a literal conversion.

On Wednesday, June 1, 2016, eksperimental <[email protected]>
wrote:

> I came across when writing a macro that created functions after atoms.
> I had the idead that to convert from atom to string, we could
> interpolate the atom into the string, or we could use Atom.to_string/1.
>
> Interactive Elixir (1.2.4) - press Ctrl+C to exit (type h() ENTER for
> help) iex(1)> atom = :foo :foo iex(2)> atom |> Atom.to_string
> "foo"
> iex(3)> "#{atom}"
> "foo"
> iex(4)> atom = :nil
> nil
> iex(5)> atom |> Atom.to_string
> "nil"
> iex(6)> "#{atom}"
> ""
>
>
> Is this a bug?
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:;>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/20160601065326.4fd4c576.eksperimental%40autistici.org
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Director of R&D

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BKghYfwakivVM5BjYXpUYK7TU78HXK2m3qEzTKR1Boqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to