Ah, I thought perhaps it was a keyword with a special grammar. This makes sense, thanks for responding :)
Gilbert On Wednesday, August 24, 2016 at 6:45:59 PM UTC-5, José Valim wrote: > > with is a construct like any other in the language, such as my_fun, > your_fun and so on. It is bound by the same grammar rules and we don't plan > to add exceptions. You should use the backslash or explicitly use parens. > > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > On Thu, Aug 25, 2016 at 12:03 AM, Gilbert <[email protected] > <javascript:>> wrote: > >> Hi, I am in the process of learning Elixir, and let me first say I am >> astounded at how polished the language and build tools are. A grand >> applause is well deserved to everyone who has helped Elixir get this far! >> >> I have only a minor suggestion. It seems to be easy to do, so here it >> goes. >> >> The `with` clause is excellent. This works, for example: >> >> msg = >> with {:ok, data} <- read_line(socket), >> {:ok, command} <- KVServer.Command.parse(data) >> do >> KVServer.Command.run(command) >> end >> >> However, I'd like to write it in this style, in effort to reduce line >> width (and, IMO, increase readability): >> >> msg = >> with \ >> {:ok, data} <- read_line(socket), >> {:ok, command} <- KVServer.Command.parse(data) >> do >> KVServer.Command.run(command) >> end >> >> But, as you can see, I need to add a backslash after the `with` keyword >> for it to compile. >> >> Is there a technical reason for the backslash requirement? Or could >> perhaps Elixir be updated to support this style of formatting, without the >> backslash? :) >> >> I am using Elixir 1.3.2 >> >> Thanks for reading, >> Gilbert >> >> -- >> 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/1d816043-d473-4ced-8194-6c1227232e99%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/1d816043-d473-4ced-8194-6c1227232e99%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/75063295-4310-4f07-bbaf-8db76e720764%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
