Improved Inline Section Handling
Pre-release
Pre-release
This draft improves the handling of some inline sections and section headers that store values.
Both catch ...
and loop ... in ...
can now accept any settable expression instead of just local variables.
try:
assert false
catch {@error}:
print "hello"
loop {@item} in {list}:
print {@item}
These two sections now properly support being inlined, although their inline mode is slightly different from usual.
Instead of affecting the remainder of their current block, both the inline loop and the catch will now only affect their current line.
print "start"
loop {item} in {list}
print "end"
// {item} will be the final iterated item
To compensate for this, the function expression now supports a special set mode, where the first provided argument shall be replaced by the set value.
This allows a function to be used in both of these inline headers.
print "start"
loop function(null) in {list} // the `null` value is replaced by the iterator value
// function(...) will be run for each item in the list
print "end"
Full Changelog: 1.0.26...1.0.27