Allen Wirfs-Brock (2013-11-11T17:53:58.000Z)
domenic at domenicdenicola.com (2013-11-13T17:03:41.431Z)
On Nov 11, 2013, at 12:51 AM, Brendan Eich wrote: > You must mean AssignmentExpression -- no ES6 draft allows comma expressions after extends. Yes, my recollection is we wanted to leave open the possibility that comma in the extends clause might, in the future, have special meaning. > No, "for programmers" is not an abstract claim you can make based on grammar details, it depends on what "most programmers" expect and *actually use*. Class head syntax for most programmers is not considered a place to put arbitrary expressions, e.g., involving && or * / % or unary+/-. > > The idea that programmers will face complexity in not being able to write > > class MyWidget extends objWithValueOf + haha { ... } > > and instead have to write > > class MyWidget extends (objWithValueOf + haha) { ... } > > is silly. Hardly any programmers, in the first place, will write any ternary, binary, or unary operator expression after extends. No, I think you're missing the point. Of course, most programmers will never even consider writhing anything more complex than a function call in the extends clause. But the extra complexity of having restricted expression forms in some places does add to the overall conceptual burden on programmers. > It's quite likely? Evidence? Evidence to the contrary? I'll cite personal experience. I find that when I'm using (particularly on a casual basis) a language with lots of rules, exceptions, and inconsistencies that I'm frequently have thoughts like "is this kind of expression allowed here?" The concern isn't that when somebody needs to do something like: class extends (isBinary? Float64Array : Array) { that they will need to remember to use parenthesis. The concern is that because this restriction exists it may cause them to think about whether they need parenthesis many other places. > That's enough to be a minor blight, and worse, you are now forbidding someone from writing a class declaration *or expression* in a generator, and using yield to send a value in as the base class to extend. Why? I'm not sure what you are saying. They only restriction I had in mind was that the expression within the extends clause could not end with the keyword 'yield'. You couldn't say: class extends yield {constructor() {... but instead would have to say class extends (yield) {constructor() {... or class extends yield undefined {constructor() {... > You argument from expected grammar is backwards and doesn't make sense. Meanwhile, a send into a > > yield class extends (yield) { ... } > > in a generator would be denied for no good reason. And you've crudded up the grammar with a parameterized check that is not otherwise needed. see above, not what I'm saying. > I think it's time for the devil to yield, no pun intended. Actually, in the past I have suggested exactly such a LHSExpression restriction in various places (including computed property keys and perhaps even in the extends clause) and the committee push back was that such restrictions were generally undesirable...