Open vklquevs opened 7 years ago
@vklquevs Do you have any syntax in mind for how this should work?
I thought about that for a while before creating this issue, and could only come up with 3 things to add an element to the end of an array:
gx set .foo[] bar
gx append .foo bar
gx set .foo[0] bar
My thoughts:
gx view .foo[]
gx set
to add to an objectgx set .foo[.foo.length] bar
(could be verbose depending on array length syntax)Option 3 would have to deal with the user attempting to introduce gaps in the array (probably just with an error message).
It would also have the side-effect of introducing an array length getter by necessity of ergonomics (previously I have looped over an array by incrementing the index until gx
crashed, but that's a different story).
To me, these options are fairly equally match in pros and cons, with each having problems the others don't.
It's possible to create an array and edit existing entries, but not add or delete.