Hi all,
Consider the following code:
defmodule WSigilTest do
def t1 do
~w(abc def ghi)
end
def t2 do
~w(abc, def, ghi)
end
end
I was working with some Ecto code and had a changeset and rather foolishly
used the form in the function t2 rather than the form in t1. In case
anyone else isn't clear on the difference:
iex(3)> WSigilTest.t1
WSigilTest.t1
["abc", "def", "ghi"]
iex(4)> WSigilTest.t2
WSigilTest.t2
["abc,", "def,", "ghi"]
Notice the comma appended to each string in t2? I didn't. :)
I realize that we need to be careful of syntax, of course, but would it be
possible to maybe add a compiler warning when someone includes commas in
the string passed to ~w? I would be glad to see about creating a PR for
this but I first wanted to see if there's even any interest in the idea.
Maybe it's just me since I don't have a background in Ruby; I guess the ~w
comes pretty much straight from Ruby.
Please let me know your thoughts on this.
--
Onorio
--
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/06431f8a-387c-48a1-9156-a1a33e1dc0d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.