Consider using indentation for line-continuation
buster-blue opened this issue · comments
Currently, it seems that the only way to continue a statement over multiple lines is to use the backslash character, like Python does. Another programming language that uses significant indentation is Ante, and it has an interesting alternative to backslashes. Instead, you can continue a line across multiple lines by indenting the following lines. So for example, in Erg, this expression:
1..100 \
|>.iter() \
|>.filter i -> i % 2 == 0 \
|>.collect Array
could instead by written as:
1..100
|>.iter()
|>.filter i -> i % 2 == 0
|>.collect Array
Which I think looks much better, and it's also easier to see at a glance where the line continuations are happening, because they're visually grouped.
For what it's worth, Nim also appears to allow you to continue lines this way.
func increment(num: Natural): Natural = num + 1
let testNum: Natural = 0
let testNum2 = testNum
.increment
.increment
assert testNum2 == 2
This relates to #393.