According to 
https://groups.google.com/forum/#!topic/elixir-lang-core/GeXNvzzmdps, it 
seems that if you allow zero arity with & there is an ambiguity when 
parsing the expressions.
&fun/2 could be parsed as (fn -> fun end) / 2 or fn(x,y) -> fun(x,y) end


On Thursday, July 21, 2016 at 12:29:06 AM UTC-3, Scott Parish wrote:
>
> Another one is: :timer.tc(&mycode(args))
>
> Or the case where this originally came up today: retry_num_times(10, 
> &fn_that_may_not_succeed_immediately!(args))
>
> On Wed, Jul 20, 2016 at 7:22 PM, Ben Wilson <[email protected] 
> <javascript:>> wrote:
>
>> The title is a bit misleading as it implies that Elixir doesn't have `fn 
>> -> "yo" end`, but at least that's cleared up in the body.
>>
>> I do think it can be useful, IE `Task.async(&foo(args))` is more succinct 
>> than `Task.async(fn -> foo(args) end)`. Spawning processes and the like are 
>> about the only cases I can think of where zero arity functions are used 
>> frequently, but it does seem like it would be a win for consistency and 
>> readability in certain cases.
>>
>> Perhaps there are ambiguities introduced however without &1 and friends? 
>> I'm sure one of the core team members will clarify.
>>
>> On Wednesday, July 20, 2016 at 8:01:01 PM UTC-4, Scott Parish wrote:
>>>
>>> It seems inconsistent that the anonymous function sugar is not allowed 
>>> for zero arity functions. Is there a good reason for this, or did this need 
>>> to be proposed as a feature request instead of a bug?
>>>
>>> Reference: https://github.com/elixir-lang/elixir/issues/5042
>>>
>>> Thanks
>>>
>>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "elixir-lang-core" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/elixir-lang-core/HsrPwDjg964/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elixir-lang-core/41bfc1d9-fce2-46f1-b72b-5429d0f4fc6b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/41bfc1d9-fce2-46f1-b72b-5429d0f4fc6b%40googlegroups.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/254f4040-f343-48a0-964e-a8fef7892893%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to