strawman for the := operator

David Herman dherman at mozilla.com
Wed Aug 8 18:11:49 PDT 2012


On Aug 8, 2012, at 5:01 PM, Brendan Eich wrote:

> The problem is that neither = nor Object.defineProperty can be used succinctly and reliably to shadow or override.

OK, that's the real problem, thanks for making it clear -- sorry if I missed it before.

>> Allen should correct me, but I think he doesn't disagree, since he says:
>> 
>>> And, := should not be thought of or become the common way to do assignment.   That should remain the job of =
> 
> (That double-cited text is not mine, however -- it is from Allen, in reply to me to Doug -- but Allen is not on your To/cc list for some reason...)

Yes, I was purposefully quoting Allen (note my words, "Allen should correct me... he says:") from another message via copy/paste-quoted. I try to avoid needless proliferation of messages when I can condense into a single reply.

>> If it's not common, then that's a strong case against getting dedicated syntax.
> 
> That is a bit circular.

I was not saying "if it's not already common then we shouldn't support it" -- you know me, that's not an argument I would make. Allen was saying it should not *become* the common way to do assignment. So then the question becomes: how common should it be, then? Are the use cases it addresses common enough to warrant new syntax?

You've clarified that this is about working around the problem of non-overridable prototype properties. That's a real issue, I agree, but I'm not convinced it's general enough to need syntax.

> The deeper point: maybe it's too late to fix anything (for Caja, or on balance). But Allen argues the future of JS is longer than its past.

Again, I'm not arguing the pave-nothing-but-cowpaths argument. I'm simply arguing that syntax needs a better justification than whether it solves a problem; it needs to fit in as a comfortable, central idiom. Especially syntax that looks like a new variation on an existing thing. ("Wait, which kind of assignment do I need to use here?") But I need to study the strawman more.

Dave



More information about the es-discuss mailing list