strawman for the := operator

Axel Rauschmayer axel at rauschma.de
Wed Aug 8 21:36:55 PDT 2012


> I still find the difference between assigning and defining very subtle. I am still trying to fully wrap my head around it.
> 
> The best way to think about it is to think of how innerHTML works. If you "define" a property called "innerHTML", it would pave over the existing innerHTML and all of the semantics would be lost. When you "assign" to elem.innerHTML, the accessor semantics handle updating the DOM with the value given as the AssignmentExpression on RHS.
> 
> Hopefully that helps?

Thanks. With properties, we are missing the clarity that we have with variables: You can’t assign to an undeclared variable (in strict mode). With properties, assignment “auto-declares” if there is no own property and no setter. So things are less clear.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120809/6149a996/attachment.html>


More information about the es-discuss mailing list