You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for [k, v] in o is pretty cool but I was thinking it would be even nicer to have for k: v in o, which then allows for k:: v in o to iterate over hidden fields and for k::: v in o to hit all fields.
I'm happy to have a crack at it if you like the idea but it’s not a priority.
Notes:
Perhaps for [k]: v in o is better, since k is a variable, not a literal field name.
This syntax might allow order-preservation via for k: v preserve_order in {b: 1, a: 2}.
The text was updated successfully, but these errors were encountered:
The [k, v] syntax is not something special made for object comprehension, this is a object deconstruction syntax, which is available in other contexts, i.e
local [a, b] = [1, 2];
The only thing added to comprehension is a semantic change, which allowed iteration over objects, which yields [key, value] pairs, I'm not sure how I feel about adding special syntax just for that, even if it does allow to implement order preservation here.
for [k, v] in o
is pretty cool but I was thinking it would be even nicer to havefor k: v in o
, which then allowsfor k:: v in o
to iterate over hidden fields andfor k::: v in o
to hit all fields.I'm happy to have a crack at it if you like the idea but it’s not a priority.
Notes:
for [k]: v in o
is better, sincek
is a variable, not a literal field name.for k: v preserve_order in {b: 1, a: 2}
.The text was updated successfully, but these errors were encountered: