Re: class sugar: static inheritance

2011-06-08 Thread Kam Kasravi
On Jun 8, 2011, at 12:57 PM, Bob Nystrom wrote:. > > Patterns like this have the advantage of supporting more than two interfaces. > Where public/protected lets you define two windows, "to everyone" and "to my > subclass", using composition to form those interfaces lets you define more > fin

Re: class sugar: static inheritance

2011-06-08 Thread Bob Nystrom
On Wed, Jun 8, 2011 at 11:50 AM, Allen Wirfs-Brock wrote: > One of their main points is that the extensibility interface that a class > exposes to subclasses should be treated as a distinct interface from the > interface that the classes exposes to external clients. > This is an excellent insight

Re: class sugar: static inheritance

2011-06-08 Thread Allen Wirfs-Brock
On Jun 8, 2011, at 9:55 AM, Brendan Eich wrote: > On Jun 8, 2011, at 8:50 AM, Mark S. Miller wrote: > >> On Wed, Jun 8, 2011 at 8:27 AM, Brendan Eich wrote: >>> Btw, in both C++ and Java, the semantics of "protected" is a mess, in >>> different ways. >> >> Sure. Let's not make those mistakes.

Re: class sugar: static inheritance

2011-06-08 Thread Mark S. Miller
On Wed, Jun 8, 2011 at 11:22 AM, Bob Nystrom wrote: > > > On Wed, Jun 8, 2011 at 9:55 AM, Brendan Eich wrote: > >> We can definitely leave protected out. My "seems inevitable" was in >> response to Kam bringing it up via a question that I expect will be >> frequently asked. >> > > I really hope

Re: class sugar: static inheritance

2011-06-08 Thread Bob Nystrom
On Wed, Jun 8, 2011 at 9:55 AM, Brendan Eich wrote: > We can definitely leave protected out. My "seems inevitable" was in > response to Kam bringing it up via a question that I expect will be > frequently asked. > I really hope we can. My interest in adding class syntax to JS was that I saw the

Re: class sugar: static inheritance

2011-06-08 Thread Brendan Eich
On Jun 8, 2011, at 8:50 AM, Mark S. Miller wrote: > On Wed, Jun 8, 2011 at 8:27 AM, Brendan Eich wrote: >> Btw, in both C++ and Java, the semantics of "protected" is a mess, in >> different ways. > > Sure. Let's not make those mistakes. Non-fixable in your view? > > > Not necessary in my view

Re: class sugar: static inheritance

2011-06-08 Thread Kam Kasravi
Mark Miller wrote > Actually, it isn't another topic. It's why Kam's GilaMonster cannot see > Monster's "health". "private" means "private to the class", not "private to > the class and subclasses". "protected" would mean the second, and no, I don't > think it's inevitable. > Aren't there als

Re: class sugar: static inheritance

2011-06-08 Thread Mark S. Miller
On Wed, Jun 8, 2011 at 8:27 AM, Brendan Eich wrote: > Btw, in both C++ and Java, the semantics of "protected" is a mess, in > different ways. > > > Sure. Let's not make those mistakes. Non-fixable in your view? > > Not necessary in my view. There are all sorts of old constructs that address needs

Re: class sugar: static inheritance

2011-06-08 Thread Brendan Eich
On Jun 8, 2011, at 8:14 AM, Mark S. Miller wrote: > The "private record" especially views as an "object" is a kind of placeholder > too. It doesn't help to think of it as a record. It probably does not help to > think of it as an object, either, especially if you cannot get at it via > anything

Re: class sugar: static inheritance

2011-06-08 Thread Brendan Eich
On Jun 8, 2011, at 3:41 AM, Kam Kasravi wrote: > I was wondering if this could be solved in some way without explicitly > referencing the particular Constructor. This isn't a static private issue per > se, rather a suggestion for an operator that would allow one to reference > Monster.allMonste

Re: class sugar: static inheritance

2011-06-08 Thread Mark S. Miller
On Wed, Jun 8, 2011 at 3:41 AM, Kam Kasravi wrote: > > Which may be a slippery slope :( BTW is it premature to ask questions on > harmony proposals in their current state? > Hi Kam, not at all. Such questions are welcomed, and will provoke us to clarify these proposals quickly. Thanks. --

Re: class sugar: static inheritance

2011-06-08 Thread Mark S. Miller
On Wed, Jun 8, 2011 at 3:05 AM, Brendan Eich wrote: > On Jun 8, 2011, at 2:45 AM, Kam Kasravi wrote: > > Just as the private(this) is used to expose the private instance record, > > > Please read > > private(this), e.g., is > >- unbearably verbose; > - leaks an implementation detail. > >

Re: class sugar: static inheritance

2011-06-08 Thread Kam Kasravi
Sorry iPad autocorrection strikes again... The comment towards the bottom should read: > I was attempting to keep as close as possible to the terminology used in the > proposal. On Jun 8, 2011, at 3:41 AM, Kam Kasravi wrote: > > > On Jun 8, 2011, at 3:05 AM, Brendan Eich wrote: > >> On Jun

Re: class sugar: static inheritance

2011-06-08 Thread Kam Kasravi
On Jun 8, 2011, at 3:05 AM, Brendan Eich wrote: > On Jun 8, 2011, at 2:45 AM, Kam Kasravi wrote: > >> Just as the private(this) is used to expose the private instance record, > > Please read > > private(this), e.g., is > unbearably verbose; > leaks an implementation detail. > from http://wi

Re: class sugar: static inheritance

2011-06-08 Thread Brendan Eich
On Jun 8, 2011, at 2:45 AM, Kam Kasravi wrote: > Just as the private(this) is used to expose the private instance record, Please read private(this), e.g., is unbearably verbose; leaks an implementation detail. from http://wiki.ecmascript.org/doku.php?id=harmony:classes#open_issues. The syntax

Re: class sugar: static inheritance

2011-06-08 Thread Kam Kasravi
Just as the private(this) is used to expose the private instance record, could static([[Constructor]]) be introduced to provide access to the union of static properties across the set of constructor objects? (I know that their is some concern about the lengthy syntax of private()) Regarding the

Re: class sugar: static inheritance

2011-06-06 Thread Allen Wirfs-Brock
On Jun 6, 2011, at 10:32 AM, Brendan Eich wrote: > On Jun 6, 2011, at 10:19 AM, Bob Nystrom wrote: > >> On Sun, Jun 5, 2011 at 9:35 PM, Peter Michaux wrote: >> Based on my understanding of what the desugared code would be, the >> last line above would be an error because Dragon.allMonsters is >

Re: class sugar: static inheritance

2011-06-06 Thread Brendan Eich
On Jun 6, 2011, at 10:19 AM, Bob Nystrom wrote: > On Sun, Jun 5, 2011 at 9:35 PM, Peter Michaux wrote: > Based on my understanding of what the desugared code would be, the > last line above would be an error because Dragon.allMonsters is > undefined. > > That's correct. Do you have any examples

Re: class sugar: static inheritance

2011-06-06 Thread Bob Nystrom
On Sun, Jun 5, 2011 at 9:35 PM, Peter Michaux wrote: > Based on my understanding of what the desugared code would be, the > last line above would be an error because Dragon.allMonsters is > undefined. That's correct. Do you have any examples of code where inheriting the constructor objects would

Re: class sugar: static inheritance

2011-06-06 Thread Mark S. Miller
On Sun, Jun 5, 2011 at 9:35 PM, Peter Michaux wrote: > Are static members inherited? What happens in the last line of the > following code? > >class Monster { >static allMonsters = []; > >constructor() { >Monster.allMonsters.push(this); >} >} > >clas

class sugar: static inheritance

2011-06-05 Thread Peter Michaux
Are static members inherited? What happens in the last line of the following code? class Monster { static allMonsters = []; constructor() { Monster.allMonsters.push(this); } } class Dragon extends Monster { constructor() {} } new M