12 ms·
You are destructuring the object here, and since it is a record type that is nothing more than its typed, ordered fields listed in the constructor, you just use
by kaba0 3y ago
You are destructuring the object here, and since it is a record type that is nothing more than its typed, ordered fields listed in the constructor, you just use it as its reverse function here, basically.
Destructuring for other kind of objects are planned with user-defined destructors. But it does have plenty prior art, e.g. in haskell you can deconstruct lists arbitrarily like _:secondElem:rest would bind secondElem logically.