Will this approach work okay with cases where the items are themselves multi-line expressions? That's the first question/concern that comes to mind.
This brings to mind the ; in JavaScript, where it can now be omitted at the end of a line. I haven't actually tried (besides for loops) but I assume you'd still need it if you want to have multiple statements on a single line. I don't know if it is equivalent though.
Expressions in Leaf don't extend beyond a line unless they belong to an open pair, such as (), {}, or [].
For example, this is invalid:
var a = 5 +
7
Single item value-lists can be used to extend beyond a line:
var a = (5 +
7)
This will work inside tuples as well, in cases where you need extra formatting:
var items = [
one
(some_condition ?
first_value |
second_value
)
third
]
I'll be encouraging a style that discourages such inline complexity. Given that types are inferred anyway, it's usually not much of a problem to do this instead:
var two = (some_condition ?
first_value |
second_value
)
var items = [
one
two
third
]
I'm not a big fan of cramming too much into a single expression as it makes the code harder to follow.
There'll potentially also be a let syntax:
let two = (some_condition ?
first_value |
second_value
)
var items = [
one
two
third
]
I'm thinking of making this a kind of lazy-evaluation that doesn't actually introduce a real variable.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Will this approach work okay with cases where the items are themselves multi-line expressions? That's the first question/concern that comes to mind.
This brings to mind the
;
in JavaScript, where it can now be omitted at the end of a line. I haven't actually tried (besides for loops) but I assume you'd still need it if you want to have multiple statements on a single line. I don't know if it is equivalent though.Expressions in Leaf don't extend beyond a line unless they belong to an open pair, such as (), {}, or [].
For example, this is invalid:
Single item value-lists can be used to extend beyond a line:
This will work inside tuples as well, in cases where you need extra formatting:
I'll be encouraging a style that discourages such inline complexity. Given that types are inferred anyway, it's usually not much of a problem to do this instead:
I'm not a big fan of cramming too much into a single expression as it makes the code harder to follow.
There'll potentially also be a
let
syntax:I'm thinking of making this a kind of lazy-evaluation that doesn't actually introduce a real variable.