extension to Set Literal Prototype operator as minimal
classes
On Oct 2, 2011, at 1:32 PM, Russell Leggett wrote:
...
I can see the recursive stache useful in some situations (although
it is another syntax addition to object literals). It would allow for
the ability to apply a deeply nested patch
What distinguishes it is that I was adding a new case to | operator where
the LHS is a constructor function and the RHS is an object literal. My
intention was that SuperClass would be the constructor function not a
prototype. Perhaps this is confusing because the return type is not the same
const Person = Mammal | {
name: 'John Doe',
constructor(sex,name) {
super.constructor(sex);
this.{name}
}
}
console.log(typeof Person); //'object', not 'function'
console.log(Person.name); //'John Doe'
Person is the prototypal person. You would then
Your last requirement is the rub. As currently defined,
prototype: { ...}
would replace the value of the constructor's 'prototype' property which would
mess up the implicit constructor/prototype wiring. Defining : to mean .{ if
the property already exists seems fragile and precludes
Subject: Re: Minor extension to Set Literal Prototype operator as minimal
classes
On Oct 2, 2011, at 1:32 PM, Russell Leggett wrote:
...
I can see the recursive stache useful in some situations (although
it is another syntax addition to object literals). It would allow for
the ability
);
@title = title;
}
does not.
From: Allen Wirfs-Brock al...@wirfs-brock.com
To: Russell Leggett russell.legg...@gmail.com
Cc: Axel Rauschmayer a...@rauschma.de; es-discuss es-discuss@mozilla.org
Sent: Sunday, October 2, 2011 3:19 PM
Subject: Re: Minor extension to Set Literal
Addendum: With the definition of the new operator as below (for non-function
operands, if the operand is a function, things stay the same), do you think a
reference from Person.constructor.prototype to Person is still necessary?
operator new(proto, ...args) {
let o =
On Oct 3, 2011, at 4:19 AM, Axel Rauschmayer wrote:
Addendum: With the definition of the new operator as below (for non-function
operands, if the operand is a function, things stay the same), do you think a
reference from Person.constructor.prototype to Person is still necessary?
On Oct 1, 2011, at 8:23 PM, Axel Rauschmayer wrote:
...
What do you think about the following variation of Allen’s pattern?
const ClassName = SuperClass | function(/*constructor parameters */) {
//constructor body
super.constructor(/*arguments to super constructor */);
On Sun, Oct 2, 2011 at 3:52 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
It's only a one character change but it eliminates the hazard that some
people are concerned about of leaving off the .constructor or
.constructor.{...} at the end of the pattern. Also, I can imagine that
On Oct 2, 2011, at 1:32 PM, Russell Leggett wrote:
...
I can see the recursive stache useful in some situations (although
it is another syntax addition to object literals). It would allow for
the ability to apply a deeply nested patch to an object, which is
sort of interesting to think
On Oct 2, 2011, at 6:19 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
On Oct 2, 2011, at 1:32 PM, Russell Leggett wrote:
...
I can see the recursive stache useful in some situations (although
it is another syntax addition to object literals). It would allow for
the ability to apply
On Oct 2, 2011, at 5:02 PM, Russell Leggett wrote:
On Oct 2, 2011, at 6:19 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
Is that the
SuperClass | {
...
}
part evaluates to the prototype object, not the constructor function and
hence what you would be
On Oct 2, 2011, at 8:19 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
On Oct 2, 2011, at 5:02 PM, Russell Leggett wrote:
On Oct 2, 2011, at 6:19 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
Is that the
SuperClass | {
...
}
part evaluates to the
I'm probably not the first to have thought of this, but it seemed like
the most minimal class support I could think of, and it sounds like
that's where things are headed from the lack of agreement. Through the
additions made by the Set Literal Prototype operator proposal, I think
you nailed 90% of
const ClassName = SuperClass | {
constructor(/*constructor parameters */) {
//constructor body
super.constructor(/*arguments to super constructor */);
this.{
//per instance property definitions
I'm not opposed to the class literal as much as I was trying to think of the
most minimal classes that could find some consensus. It seems from the
discussion that if no syntax can be agreed on, then perhaps it would have to
wait for ES.next.next.
The problem with the class literal syntax that
17 matches
Mail list logo