Closed sirisian closed 2 days ago
Added initial changes here:
https://github.com/sirisian/ecmascript-types/blob/master/README.md#value-type-references
I've deferred to the ref proposal which seems sound. Changed to ref keyword rather than complicate things with using & which is used in intersection types probably.
Since performance is a core part of adding native types it's probably good to ensure that any reference proposal syntax is compatible with value type classes and such.
Related to #71 (which is still a WIP) since one might reference array elements.
https://es.discourse.group/t/passing-by-reference/865/12 https://es.discourse.group/t/draft-for-a-proposal-of-an-explicit-reference-syntax/1475
I quite like using
&
token over aref
keyword, but that can be figured out later.Stack issues detected by the scope?
Also WIP, but I kind of want to "fix" Map if possible with this. The ability for function to return references. hmm this seems difficult:
https://es.discourse.group/t/map-weakmap-etc-prototype-getref-key/884
The FAQ for emplace has a section about this as well with returning multiple references and order of operations and such.
One could imagine syntax to get a map item that returns a reference. Not sure what would happen if it didn't exist. Undefined?
Can one reassign a reference?