Could we warn only if both a function and a var exist, as in the Plug test case?
I think the narrowest warning that would still happen on your examples of bad behavior is where we should start. On Sun, Dec 4, 2016, 10:11 AM José Valim <[email protected]> wrote: > > could we at least not warn if the ambiguity can be resolved at compile > time—if there’s a function/0 available with the given name, just compile it > as a call and move on? > > That's exactly the behaviour we had before. After all, if you do not have > a variable nor a function name, it wouldn't compile with reason no variable > or function named x. > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > On Sun, Dec 4, 2016 at 6:36 PM, Dave Thomas <[email protected]> wrote: > > On Saturday, December 3, 2016 at 10:12:30 AM UTC-6, José Valim wrote: > > > Basically, what compelling problem drove this change? It isn't an issue > I ever had before, and the change seems to make my code worse. > > There were a couple scenarios that I either personally ran into or were > frequently reported. One of those came from Plug test suite. In Plug it is > common to pass the connection named as "conn" around between setup/tests: > > So we lose things like this? > > iex(2)> v > warning: variable "v" does not exist and is being expanded to "v()", please > use parentheses to remove the ambiguity or change the variable name > iex:2 > > There’s a simple cure for variable/function ambiguity—choose good names > and write trivial functions. This kind of thing typically bites when your > code is struggling in some extended swamp of names. Maybe being bitten on > those occasions is just what the developer needs to stop doing it :) > > Even if you really, really want to do this (please reconsider), could we > at least not warn if the ambiguity can be resolved at compile time—if > there’s a function/0 available with the given name, just compile it as a > call and move on? > > Dave > > > > -- > 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/CAGnRm4KPq2UyFF2qP-FwFAagG-KCoKam_GfHgwztC0sm9j3NgQ%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KPq2UyFF2qP-FwFAagG-KCoKam_GfHgwztC0sm9j3NgQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAOMhEnw-vUP89JsqNbNwiYuK91dAQ3g2abK7B9d%3D%3DxbO-BArwg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
