On 2007-08-21, at 11:04 EDT, Lars T Hansen wrote:
[...]
>> I want a generic function
>> that can refer to the class that it is a static property of. Will
>> that be possible?
>
> But it's not really generic, is it? It's statically inside a class
> the way you've written it above. I'm guessing you mean "generic" from
> a code generator's point of view, and you'd like to avoid
> parameterizing the generator of that function with the class name.
>
> (On the other hand, if you're suggesting something like this:
>
> class A {
> public static var v;
> }
> A.v = function () { ... this class ... }
>
> then I think probably not.)
The es3 code is:
function A () ...;
A.zot = function zot () { ... this ... }
function B () ...;
B.prototype = new A();
B.zot = A.zot;
hence `this` is A in A.zot and B in B.zot.
I was thinking the equivalent es4 would be:
class A {
static function zot () { ... this class ... };
}
class B extends A {
static var zot = A.zot;
}
so I would need `this class` to be `B` in `B.zot`. Per your
'probably not', I guess that isn't going to work. Is there a better
way? Or do I have to duplicate the code for zot in each subclass?
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss