x = %{x: 1}

with %{x: x} <- x do
  IO.inspect x
end

^ This works.

x = %{x: 1}

with
  %{x: x} <- x
do
  IO.inspect x
end

^ This is a syntax error.

Proposing that the latter should be allowed for 2 reasons:

1) it looks like it should work ¯\_(ツ)_/¯
this sounds like trolling but is really not. the syntax that looks valid 
should be valid.

2) it is better, more consistent for indentation and code formatting.

with %{a: a} <-
       some_really_long_line_about_a,
     %{b: b} <-
       some_really_long_line_about_a
do
  ...
end

^ this is what it would look like when formatted with the current syntax 
rules

   - note the indentation of line 2 is 7 spaces
   - and line 3 is indented 5 spaces


if newline is allow after `with`

with
  %{a: a} <-
    some_really_long_line_about_a,
  %{b: b} <-
    some_really_long_line_about_a
do
  ...
end

^ it would look like that

   - everything is indented consistently, 2 spaces and 4
   - no need to waste extra horizontal space
   - also makes it easier for text editors to auto indent without having 
   trouble with abnormal indent sizes

-- 
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/89a99c8f-a046-4639-b348-e475c0c5a515%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to