Sep 27 meeting notes

Oliver Hunt oliver at apple.com
Thu Sep 29 18:25:26 PDT 2011


On Sep 29, 2011, at 6:20 PM, Brendan Eich wrote:

> On Sep 30, 2011, at 1:11 AM, Erik Arvidsson wrote:
> 
>> On Thu, Sep 29, 2011 at 17:08, Bob Nystrom <rnystrom at google.com> wrote:
>>> class Monster {
>>>   constructor(this.name, this.health) {}
> 
> I <3 this. It beats the (public name, public health) variant in my view by being explicit and not dragging in p-words.

I dislike it as it conflates assignment with declaration.

> 
> 
> This is great, and I'm still a sections fan, but they mix badly if there are any hints or smells of object literal data property initialiser synax. You (Bob) dodge that by using let, Oliver used var (and IIRC Bob started with var; so did ES4) -- however, Oliver and ES4 by fiat put data properties on the instance, methods on the prototype.
> 
> Separately, and a while ago, Alex pointed out that mutable prototype data properties, e..g let attackers = []; in this Monster example, are a footgun. People fail to shadow and mutate a shared singleton.
> 
> So why do we need declarative syntax for data properties on the prototype at all? Data properties on prototypes are exceedingly rare and usually a bug.

Agreed.  If anything people want constants on "the class"

--Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110929/812c086f/attachment.html>


More information about the es-discuss mailing list