On 2006-11-01, at 13:54 EST, Adam Wolff wrote:
I think that the right syntax here would be:
super.appply( super.foo , arguments );
Of course all of this would have to be special-cased because there
is no
real "super" object as such. That, in turn, might lead to
confusion, since
one might expect a reference to super.bar to refer to my superclass's
value for bar, whatever mine may be.
Close, but not quite.
On 2006-11-01, at 12:30 EST, Jim Grandy wrote:
But the "args" parameter to determinePlacement is the parameter
passed into LzNode.construct. It's just passed through to
determinePlacement in case someone wants to grovel through the init
args when deciding placement.
Er, we're missing here. args !== arguments. What I wrote:
super.determinePlacement.apply(this, arguments);
is the 'standard' way to invoke the method you overrode with the same
arguments you were called with. (I.e., it solves Jason's problem
with having to guess how many arguments you were called with).
The only thing that is stopping us from doing that is that the parser
will not parse super.x.apply(...) as a super call. I guess I should
fix that, because it really is the right way to do it.
On Nov 1, 2006, at 8:30 AM, P T Withington wrote:
What you really want to be able to do is say:
super.determinePlacement.apply(this, arguments);
But the compiler does not (quite) support that. I spent a few
minutes trying to see how hard that would be to support, and it
was not just a quick fix (because of the way super is wedged in).
In most o-o languages I have used, there is a shorthand, like:
super();
which means 'call the method I am overriding with the arguments
that I got'. I suppose we can't get away with that, because C++
has co-opted that to mean call my superclass's constructor. But
it sure would be convenient, since I think it is much more common
to want to call the method you override and pass it all the same
arguments that to want to call your superclass constructor. [In
our world you call super.initialize anyways, so there is no
ambiguity.]
On 2006-11-01, at 09:59 EST, Jim Grandy wrote:
This is one of those situations where nobody currently uses the
parameter, but it might come in handy some day. Given that
determinePlacement is optimized in the case where there are no
overrides, there's not much overhead to passing it around. I
agree as well.
On Nov 1, 2006, at 6:36 AM, P T Withington wrote:
I agree. When calling your super method, you should pass all
the arguments that you are called with.
On 2006-10-31, at 21:36 EST, Philip Romanik wrote:
Hi Tucker,
determinePlacement() has 3 arguments but most components only
mention the first two (basetabs.lzx for example) when
overridden. This is a bit of a nit, but I think all references
to super.determinePlacement() should pass all 3 parameters. Or,
is the third parameter cruft?
Thanks!
Phil