Sep 27 meeting notes
Brendan Eich
brendan at mozilla.com
Fri Sep 30 12:13:18 PDT 2011
On Sep 30, 2011, at 9:09 PM, Oliver Hunt wrote:
>> 1. Oliver and others do want x and y to be in scope somehow. They can't be via the |this| parameter object on the scope chain, though. That's dynamic scope (the prototype is extensible, or *a* prototype, possibly Object.prototype, is). But the desire to avoid this. prefixing is natural and predictable for people coming from C++, Java, etc. Should we consider supporting this expectation somehow, rather than steering people away from it with less natural syntax?
>
> My recent proposals have not been placing member fields in scope (all my examples use this.blah), they have merely been providing a declarative syntax to define the shape of an instance of the object.
Ok, noted -- sorry, I meant to write "Gavin" not "Oliver" ;-). The idea of instance variables being in scope does keep coming up.
> I also see the constructor(this.x, ..) stuff as syntactic sugar that is unrelated to the actual class semantics -- that syntax could be added at a later date and would not impact the behaviour of classes,
Yes, agreed as far as your statement goes. We could also add it an earlier date and not impact classes, I hope you'll agree. Just trying not to cast it out into the far future.
Also, I can make a conservative case for restricting "this." parameter name prefixing to constructor. That's where it pays off, and we don't have to worry about unintended consequences in non-constructors.
> and if it were added i see no reason to restrict it solely "constructors". That said I don't like the syntax at all :D
What, if any, syntax for avoiding repeating each member name three times, do you prefer?
/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110930/22f48150/attachment.html>
More information about the es-discuss
mailing list