Re: Reifying References?
What are use-cases? C++ has references as a sugar for dereferenced pointer, but other languages leaved this approach because of confusions (mostly with memory operations). Don't think we need them much. Though, you still may to update your var passing base object (and in Rhino even for local vars of function having access to the activation object). Dmitry. On Mon, Dec 5, 2011 at 12:31 AM, Axel Rauschmayer a...@rauschma.de wrote: Any thoughts on whether it might make sense to reify References [8.7 in the ECMAScript 5 specification] in the language proper? E.g. via a function ref() (as a strawman – not really syntactically viable). Applications: - Pass a variable by reference: function incReference(r) { if (! (r instanceof Reference)) { throw new TypeError(); } r++; } incReference(ref(foo.bar.baz)); incReference(ref(myVar)); - Data binding - More options for the lhs of an assignment (advanced collections...) - Possibly: simplify some of the getter/setter APIs, but it’s probably too late for that, because this approach has become standard. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss
Reifying References?
Any thoughts on whether it might make sense to reify References [8.7 in the ECMAScript 5 specification] in the language proper? E.g. via a function ref() (as a strawman – not really syntactically viable). Applications: - Pass a variable by reference: function incReference(r) { if (! (r instanceof Reference)) { throw new TypeError(); } r++; } incReference(ref(foo.bar.baz)); incReference(ref(myVar)); - Data binding - More options for the lhs of an assignment (advanced collections...) - Possibly: simplify some of the getter/setter APIs, but it’s probably too late for that, because this approach has become standard. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss
Re: Reifying References?
This is a big de-optimizer without a sigil or mode to identify references. I don't think it will fly. It lacks compelling use-cases. The last one was VB-ish foo.items(i) = bar callable lvalues, allowed to return References if the callable is a host object, but deprecated or in the process of being deprecated (thanks to Sam Weinig for removing non-document.all [caller] uses in WebKit's IDL). /be On Dec 4, 2011, at 12:31 PM, Axel Rauschmayer wrote: Any thoughts on whether it might make sense to reify References [8.7 in the ECMAScript 5 specification] in the language proper? E.g. via a function ref() (as a strawman – not really syntactically viable). Applications: - Pass a variable by reference: function incReference(r) { if (! (r instanceof Reference)) { throw new TypeError(); } r++; } incReference(ref(foo.bar.baz)); incReference(ref(myVar)); - Data binding - More options for the lhs of an assignment (advanced collections...) - Possibly: simplify some of the getter/setter APIs, but it’s probably too late for that, because this approach has become standard. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss