Tab Atkins Jr. wrote:
Make monocle-mustache solely use the "obj.{foo=bar}"
syntax, so that the other one is a syntax error.  There's no good
reason to give devs the other type of functionality besides
completeness, and using it will almost always be a mistake on the
dev's part, I think.

Who says obj is an Object instance delegating only to Object.prototype?

Is the "setter on Object.prototype" the only observable difference
between the two?

Not for mustache, where obj can be any object, with a deep prototype chain, setters declared via ES5-standard syntax (no definePropert{y,ies}), or created by an OOP library.

As Allen points out, classes will (let's hope) allow easy declaration of deep chains too.

Beware scenario-solving in an all-or-nothing way. There's no absolute good here, and while people may (due to Prototype's Object.extend) want = not : in most cases, that doesn't mean : is unnecessary.

Another alternative: give up on mustache since it bends object literal syntax past its breaking point.

If we just standardized some flavor of Object.extend (for-in based? own or in test for properties to copy? no private names? etc.) would developers be better off?

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to