Open GokuHiki opened 1 year ago
There are now four valid cases conflicting with binary operators at the start of newlines.
do
a = value
<= f
x = do
a = value
< index >:abc
do
a = value
-1 |> f
do
a = value
~x |> f
We can either support the new syntax without <=
, <
, -
and ~
or force requiring a block indent to put these operators in newlines.
exp = longExpMain
<= longExpA -- a same indent
< longExpB -- required for
~ longExpC -- every expression
<= backcall
YueScript is a programming language that is designed to easy readable with whitespaces significant so it would make sense to force requires a block indent with multiple lines expression. It is more consistent with the rest of the language that depends on indent whitespaces heavily. And it is sure more readable this way: when you see a block indent with an operator prefix, you know it belongs to a multiple lines expression.
By the way, if do this way, there are still conflicts with the current syntax, for example:
do
a = b
* c
Thanks and regards!
Currently YueScript only supports continue expression on newline if the operator is at the end of the line. This is helpful but for me I prefer to put the operator at the beginning of the line.
I hove YueScript can support continue expression on newline if the operator is at the beginning of the line. This is more consistent with the other languages, it's more readable and easier to comment out a expression clause for convenient.
Of course, I know I can put
\
at the end of line but it just make code too ugly to look at and not readable. Thanks and regards!