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