Re: const VS static final class variable ?

2007-08-17 Thread Brendan Eich
On Aug 17, 2007, at 3:37 PM, Brendan Eich wrote: > On Aug 17, 2007, at 1:10 PM, Garrett Smith wrote: > >> what is the difference between x1 and x2? >> >> class A { >>const x1; >>static final x2; > > You need a var before x2. Also you can't add final except before > classes and methods (the

Re: Are Static Members Inherited?

2007-08-17 Thread Brendan Eich
This has come up on this list before; please see the archive: https://mail.mozilla.org/private/es4-discuss/2007-January/thread.html (the "inheriting statics" thread). Also, what section 9.2.7 do you mean? Could you cite the URL of the document containing that section? Thanks, /be On Aug 17,

Re: const VS static final class variable ?

2007-08-17 Thread Brendan Eich
On Aug 17, 2007, at 1:10 PM, Garrett Smith wrote: > what is the difference between x1 and x2? > > class A { >const x1; >static final x2; You need a var before x2. Also you can't add final except before classes and methods (the reference implementation currently parses 'class A { stati

Re: Array and Object Literal Types

2007-08-17 Thread Brendan Eich
On Aug 17, 2007, at 2:47 PM, Garrett Smith wrote: > It would be nice to have Array literal syntax declare it's ArrayType > before the declaration of the array. > > For example: > > 1. var x : Array = [ "foo", "bar", document.title, > getAnotherString() ]; Array is not a parameterized type. If i

Array and Object Literal Types

2007-08-17 Thread Garrett Smith
It would be nice to have Array literal syntax declare it's ArrayType before the declaration of the array. For example: 1. var x : Array = [ "foo", "bar", document.title, getAnotherString() ]; 2. var x = [ "foo", "bar", document.title, getAnotherString() ] : String; example 1 is more clear to re

9.6.2 - 'this' or 'super' in a static method

2007-08-17 Thread Garrett Smith
9.6.2 It is an error for the 'this' or 'super' expression to appear in the body of a static method. 1. Is this error mentioned a compile-time error? 2. Why does 'this' in a static method generate an error? (it shouldn't refer to the class?) 3. does 'superclass' in a static method refer to the clas

Are Static Members Inherited?

2007-08-17 Thread Garrett Smith
The example in section 9.2.7 demonstrates static members, including those of an ancestor superclass, being accessible through an instance. Section 9.6.2 clearly states that static methods are not accessible through derived class objects (though does not mention anything about static properties).

class prototype object vs class instance properties

2007-08-17 Thread Garrett Smith
What is the difference between a class's prototype object and it's instance properties? class A { var x : uint = 10; // instance property. prototype var x : uint = 20; // another instance property in the prototype chain. } class B extends A { } My understanding is that the result would be:

const VS static final class variable ?

2007-08-17 Thread Garrett Smith
what is the difference between x1 and x2? class A { const x1; static final x2; } ___ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss

RE: Self type

2007-08-17 Thread Eylon Stroh
Peter, This was my confusion, as well. I was about to send a reply to Cormac's email but, in working through my reply, I realized what was going on. The types are not quite equivalent to substituting T1 and T2, because Self is the concrete object type which needs to be a subtype of the defined t

Re: Self type

2007-08-17 Thread Peter Hall
I think my confusion here, is perhaps that I'm seeing this a slightly different way. What you are saying seems to suggest that Self type annotations can behave differently at runtime. To me, this example from the wiki should be an error: type T1 = { f:function(this:Self, z:Self):Self, w:int} var x