Hi Jose, I just tried going with parens, the formatter does not seem to keep parens either in this case..
On Wednesday, 31 January 2018 03:13:41 UTC+11, José Valim wrote: > > In the with proposal we explain that "with" was meant to mirror > for-comprehensions. It has been also discussed that nowhere in Elixir we > traverse the body retrieving expressions and that's not a precedent we want > to introduce in the core language itself. > > > > *José Valimwww.plataformatec.com.br > <http://www.plataformatec.com.br/>Founder and Director of R&D* > > On Tue, Jan 30, 2018 at 4:08 PM, OvermindDL1 <[email protected] > <javascript:>> wrote: > >> I'm still quite curious why `with` is not entirely in the body like >> `cond` and `case` and so forth is (ditto with `for`), so it'd be: >> >> ```elixir >> with do >> %{x: x} <- y >> x >> end >> ``` >> >> It follows the pattern of cond and so forth, no weird comma's needed, no >> weird prefix `do:` or so forth, you only need to split on `<-`, etc.... >> >> >> On Tuesday, January 30, 2018 at 5:55:58 AM UTC-7, José Valim wrote: >>> >>> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/bbf54f61-ffc4-46e3-b69f-5bbc03f0df70%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/bbf54f61-ffc4-46e3-b69f-5bbc03f0df70%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/3831e575-c289-4e37-9171-de95b8ae2477%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
