Open Greedquest opened 9 months ago
Possible v1 blocker Purely if we come up with something that steps on the toes of the new destructuring assignment syntax and want to retire that in favour of whatever this becomes
I don't think this one would be considered a blocker. If we did retire it completely, it would just be a case of the developer needing to copy the property-let procedure implementation over from the current VBA library to regain the functionality.
Related #28 & #14
Motivation
VBA has User Defined Types, Strongly typed arrays, and variant arrays. All of these should support destructuring into variables (
a,b,c = someValues
. What's more, there should be compile time type inference and run time type coercion semantics. Right now only variant arrays can be destructured and you lose all the type info, both for intellisense and for casting from one type to another. They are also better for performance than relying on variant arrays citation neededImplementation
One suggestion has been to add tuples which would be a new type primitive that can be parameterised by other types (e.g. a tuple of longs, a tuple of Foos). Named Tuples are very similar and provide
dot.access
to their members - like aPoint2D
has a.x
and a.y
but unlike a class, can also be destructured asx, y = getPoint2D()
. To be honest if user defined types could be destructured and indexed into like arrays, then they would eliminate the need for named tuples.As has been mentioned, this would solve the multiple function return problem in a type safe way.
Considerations
Representation in a compiled COM dll