Sorry for the delay in replying - been away
Both ?. and *. need to be put together to disambiguate at a syntactic level
yes but they also both dont need/shouldnt have spaces around them ( as with DOT) whereas the others (will) do.
Python's list comprehensions are most similar to Cobra's for-expression. I don't think Python has anything like the spread operator
right but the point I was aiming at was that they are a shorthand for a more verbose form and it seems that for anything other than the most simple expression uses, the more verbose construct is the one suggested to be used for maximum clarity..
re needing space forcing for ?. and *.
OK I see what you mean now.
You can make weirdly unreadable coalescing/multiplying code without spaces
The point about reading better ( or actually being used) with wrapping spaces is the most germane one
(modified compiler to pickup '?.' as own token didnt throw any spurious errors from collisions indicating either no tests of nil coalesce
(not so)
or canonical uses use wrapping spaces anyway)
re aggregator summing
Sorry - I read summing as slightly more general than just summing or multiplying by the item being referenced
(actually I read it as summing as in summing up by a constant value defaulting to 1 - a count
( probably just from looking at the += 0 expression ( thought it a typo for += 1).
So I obviously find it confusing
The step expression is the expression to assign to the aggregation variable at each step of the iteration so for your accumulator/multiplier
action then needs some placeholder for the item at each step/iteration
# generally
sum = <init-expr>
for item in items, sum = sum <op> <step-expression>
trace sum
#specifically
sum = 0
for item in items, sum = sum + item
trace sum
#becomes
trace 0: sum+itemValue: items* # spread last
# using 'sum' as placeholder for aggregator variable and
# 'itemValue' as placeholder for each single element of items ( 'item' in longer form above)
Its slightly more verbose for simple aggregation but clearer ( just use the explicit expression given) and more flexible ( can aggregate on any expression)
the impressions re the floating op and confusion with 'normal' form of expressions remain - I still think a punctuation separated form (like slices and counted for) would be preferable/clearer.
"Yes" to that last thought.
And the first question? - Is there sufficient disparity and clarity between a Stream ( Type*) and a Spread ( (enum-)variable*) .
re safeNil code gen
Ok that gives me an idea...
Looks like I need to do some tweaking around forcing need for wrapping spaces around some tokens (ASSIGN and others) for experimentation