I understand that the anonymous function is both a value and a function which is why we have to call it with parentheses. I don't understand why it needs the dot. Seems the only time that would become confusing is if you had a first class function and an Anonymous function with the same name.
I'm In favor of the one caveat of the anonymous functions needing to have the parentheses and a dot in favor of being able to use bare words. Amos King Binary Noggin > On Dec 3, 2016, at 08:34, Allen Madsen <[email protected]> wrote: > > It looks like this was already discussed here: > https://github.com/elixir-lang/elixir/issues/3268 > https://github.com/elixir-lang/elixir/pull/3517 > > I prefer bare words for the same reason as Amos. It facilitates > refactoring between methods and variables. > > If this stays, is it expected to be a compiler error in Elixir 2.0? If > so, does that mean that we would be able to call anonymous functions > without the dot? > > x = fn y -> y + 1 end > x(1) > # vs > x.(1) > Allen Madsen > http://www.allenmadsen.com > > >> On Sat, Dec 3, 2016 at 9:07 AM, Amos King <[email protected]> wrote: >> In my experience the minimize scope of data binding keeps it pretty >> straightforward. >> >> Amos King >> Binary Noggin >> >>> On Dec 3, 2016, at 07:50, Michał Muskała <[email protected]> wrote: >>> >>> The ambiguity, that bit me already several times is in the code that looks >>> like this: >>> >>> self = self() >>> do_something(self) >>> >>> Now the self in the second line can be both - calling the function and >>> accessing variable. Of course it's not confusing in this example because of >>> it's brevity, but in general it can lead to issues that are very hard to >>> debug. >>> >>> Michał. >>> >>>> On 3 Dec 2016, at 14:10, Amos King <[email protected]> wrote: >>>> >>>> I prefer being able to use the bare words. It makes refactoring simpler to >>>> move between a variable and a method which I do regularly. The warning >>>> seems strange since there isn't an ambiguity that is being decided. I'm on >>>> board with Dave here. >>>> >>>> Amos King >>>> Binary Noggin >>>> >>>>> On Dec 3, 2016, at 00:45, Louis Pilfold <[email protected]> wrote: >>>>> >>>>> I personally think this is clearer, and I don't feel this is clearer. >>>>> With this I think it is easier to tell when computation is happening- >>>>> previously it could be hidden behind what looks like variables. >>>>> Cheers, >>>>> Louis >>>>> >>>>> On Sat, 3 Dec 2016, 04:42 Dave Thomas, <[email protected]> wrote: >>>>> I’ve been loving 1.4 for a few weeks now, but I am bugged by the new >>>>> warning: >>>>> >>>>> warning: variable "int" does not exist and is being expanded to "int()", >>>>> please use parentheses to >>>>> remove the ambiguity or change the variable name >>>>> >>>>> Partly it is because it makes my code a lot uglier. For example, in >>>>> quixir, instead of >>>>> >>>>> test "two plain types" do >>>>> ptest a: int, b: list do >>>>> assert is_integer(a) >>>>> assert is_list(b) >>>>> end >>>>> end >>>>> >>>>> I now have to write: >>>>> >>>>> test "two plain types" do >>>>> >>>>> ptest >>>>> a: int(), b: list() do >>>>> >>>>> . . . >>>>> >>>>> Ugh. Even worse, the premise of the warning seems wrong. It assumes int >>>>> is a variable, which doesn’t exist. But it does know that int is a >>>>> function, because if I misspell it and put ()s on, I get a compilation >>>>> error. So why can’t it just do that: is a bare name is encountered that >>>>> isn’t a variable, just internally tack on the ()s are see what happens. >>>>> Which I think is the old way. >>>>> >>>>> 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. >>>>> >>>>> 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/22ad983c-0917-4425-abbe-a6e954ae3b61%40googlegroups.com. >>>>> 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/CAM-pwt7JgYzWnC6y1-ELHj%2BOeaJDuDCamAxJmktdeYRdLaYFEA%40mail.gmail.com. >>>>> 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/1865E0E4-7879-4307-900B-99CEF366091D%40binarynoggin.com. >>>> 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/1D0E5277-451A-4955-A3FC-D06F05E107E4%40muskala.eu. >>> 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/15857D16-3830-4916-B233-2CD929719BDF%40binarynoggin.com. >> 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/CAK-y3Csyb3ox0pGKCBuTEzK67%2BTcZGwJzx5VphWr9_4pNhwi8g%40mail.gmail.com. > 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/B1DA729A-119A-4062-8C1E-BD48BF6FFC72%40binarynoggin.com. For more options, visit https://groups.google.com/d/optout.
