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]> 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].
> 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/CABvdOJt0%2BO74iFHTpissH3O6JLOHTiLsDzaxP9LOBzKDa5ZoUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to