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

P T Withington ptw at pobox.com
Mon Sep 3 05:24:30 PDT 2007


On 2007-09-03, at 07:41 EDT, Lars T Hansen wrote:

> Now I see what you mean.  You would like "this class" to be
> dynamically scoped like "this".  Yet when we were talking earlier
> about "this function" and "this generator", they are both statically
> scoped entities -- unlike "this".  And that's how I've been thinking
> about "this class" -- as static.  The motivation for "this function"
> was to be able to reference the function enclosing the reference not
> by name, but  by some mechanism resilient to name change, and similar
> for "this generator".  So I figure, why not the class.
>
> Taking this further, would not "this" in your class-static method
> capture exactly what you want to capture (except that it's illegal
> right now and probably used by mistake about 25% of the time?)
>
> Well, that takes us full circle...

Indeed.  What I wanted was a way in a class method to say 'yes, I  
mean `this`, and it is not a mistake'.  `this class` seemed like a  
pretty good idea for that.  But not if it is going to be static.

Your solution is not quite what I had expected to do, but it will  
work, so I guess this is not a pressing need.





More information about the Es4-discuss mailing list