Good call Ben! The formatter will rewrite it though, while it does keep
parens.



*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*

On Tue, Jan 30, 2018 at 1:46 PM, Ben Wilson <[email protected]> wrote:

> This is achievable with `\` btw:
>
> with \
>   %{x: x} <- y
> do
>   x
> end
>
>
> On Tuesday, January 30, 2018 at 7:39:07 AM UTC-5, Po Chen wrote:
>>
>> Ah I thought `with` was part of the language, then I realized how small
>> the language core is.
>> Now I wish the language is actually a little bigger :S mixed feelings.
>>
>> Thanks for the reply!
>>
>> On Tuesday, 30 January 2018 23:20:49 UTC+11, José Valim wrote:
>>>
>>> Imagine you have this code:
>>>
>>>    foo = 1
>>>    bar = 2
>>>    foo bar do
>>>      :ok
>>>    end
>>>
>>> Would you expect it to be equivalent to:
>>>
>>>    foo = 1
>>>    bar = 2
>>>    foo
>>>    bar do
>>>      :ok
>>>    end
>>>
>>> It isn’t because “foo” in its own line is a valid expression. Replace
>>> “foo” by “with” and you can see why your proposed syntax doesn’t work.
>>>
>>> If you want to write it as you proposed, you need to use parens:
>>>
>>>    foo = 1
>>>    bar = 2
>>>    foo(
>>>      bar
>>>    ) do
>>>      :ok
>>>    end
>>> --
>>>
>>>
>>> *José Valimwww.plataformatec.com.br
>>> <http://www.plataformatec.com.br/>Founder and Director of R&D*
>>>
>> --
> 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/a644c670-f090-4eaf-a0df-
> fa47333519b8%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/a644c670-f090-4eaf-a0df-fa47333519b8%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/CAGnRm4JXQ7Nya%3DNgT5TAaGm7GMJAQWqiJiRpzvNbtQH9Zu_6gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to