Mailing List Archive

Tk Re: Name change list, consolidated. RFC
In <199509141147.HAA14720@bigboote.WPI.EDU>
On Thu, 14 Sep 1995 07:46:33 -0400
Terry Greenlaw <z50816@mip.lasc.lockheed.com> writes:
>> In <199509121854.NAA20361@falcon.mbsa.com>
>> On Tue, 12 Sep 1995 13:54:27 -0500
>> Doug Maxey <dwm@mbsa.com> writes:
>> >I go with Terry on this, Pack is a class with methods,
>
>> It isn't, it is a mis-mash of functions with obscure syntax ;-)
>
>We can fix that. We have the knowledge. We know the odds. We can cast Lee
>Majors to help. ;-}

I don't understand that - unless it is a reference to "$6M Man".


I am moving discussion to perl5-porters as it is more about perl than Tk,
when we have semantics sorted we can move it back.

>
>> >and calling
>> >the instance would be The Right Way (tm:).
>
>> $w->Pack::info is not the "Right Way" at all - $w is not an instance
>> of 'Pack' it is an instance of some widget.
>
>Pack::info in this case is a static method "info" in class "Pack" in
>superclass "Tk".

We are getting bogged down in jargon, but I still think you and I have
different ideas from eachother as two what anything->Package::method
actually does in perl.

>Unfortunately, the better syntax to insure inheritance (sorry I missed this
>one, Larry) and namespace isolation is Tk->Pack::info($w), which is pretty
>different from existing syntax.

It also does not do anything for namespace isolation, as I understand it
once there is a :: in the name then perl abandons inheritance and uses
thing to right of -> as fully qualified name. Thus this is still calls

package Pack; # top level name
sub info

And just happens to pass 'Tk' as 1st arg.


That is why perlbot has :

package Foo;
@ISA = qw( Bar Baz );
@Foo::Inherit::ISA = @ISA; # Access to overridden methods.


$self->Foo::Inherit::goo();

If it worked they way you imply - i.e. left hand side of -> affects
the method actually called then the neater :

$self->Inherit::goo();

Would suffice.

>The object->method syntax seems to lead
>people into thinking that every method HAS to be virtual. I'm not sure about
>perl, but static methods are much faster than virtual methods in most other
>(all other???) languages. Then again, I'm writing this at 7:00 AM, so rational
>thought is likely to be virtual as well.
>
Re: Tk Re: Name change list, consolidated. RFC [ In reply to ]
> From: Nick.Ing-Simmons@tiuk.ti.com
>
> >Unfortunately, the better syntax to insure inheritance (sorry I missed this
> >one, Larry) and namespace isolation is Tk->Pack::info($w), which is pretty
> >different from existing syntax.
>
> It also does not do anything for namespace isolation, as I understand it
> once there is a :: in the name then perl abandons inheritance and uses
> thing to right of -> as fully qualified name.

Nope. Perl uses the fully qualified package name on the right of a ->
as the name of the class to _start_ looking for the method in. It
continues up the @ISA tree from there.

Tim.
Re: Tk Re: Name change list, consolidated. RFC [ In reply to ]
: We are getting bogged down in jargon, but I still think you and I have
: different ideas from eachother as two what anything->Package::method
: actually does in perl.
:
: >Unfortunately, the better syntax to insure inheritance (sorry I missed this
: >one, Larry) and namespace isolation is Tk->Pack::info($w), which is pretty
: >different from existing syntax.
:
: It also does not do anything for namespace isolation, as I understand it
: once there is a :: in the name then perl abandons inheritance and uses
: thing to right of -> as fully qualified name. Thus this is still calls
:
: package Pack; # top level name
: sub info
:
: And just happens to pass 'Tk' as 1st arg.

Uh, no, Tk->Pack::info($w) still does inheritance. It just says to
*start* looking in package Pack for the method, but the info method
could be in any of Pack's base classes. It does override the
"virtuality" of the method though.

: That is why perlbot has :
:
: package Foo;
: @ISA = qw( Bar Baz );
: @Foo::Inherit::ISA = @ISA; # Access to overridden methods.
:
:
: $self->Foo::Inherit::goo();
:
: If it worked they way you imply - i.e. left hand side of -> affects
: the method actually called then the neater :
:
: $self->Inherit::goo();
:
: Would suffice.

While it's true that $self is not being used to select the class,
there's still inheritance going on. It seems like you're mixing up
static package nesting with inheritance, which is dynamically defined.
If ref($obj) eq "Foo" then $obj->Foo::goo() has exactly the effect as
$obj->goo().

: >The object->method syntax seems to lead
: >people into thinking that every method HAS to be virtual. I'm not sure about
: >perl, but static methods are much faster than virtual methods in most other
: >(all other???) languages. Then again, I'm writing this at 7:00 AM, so rational
: >thought is likely to be virtual as well.
: >

The only way the $obj->Package::method() syntax might run faster is
that it might cut down the search tree on initial (that is, on
uncached) calls. The only way to get a direct call in Perl is with the
ordinary subroutine call syntax, Pack::info("Tk", $w). Though I suppose
one might write it, Pack::info(Tk => $w), just to be garish.

Or maybe you guys are talking about something else. These terms are
slippery...

Larry
Re: Tk Re: Name change list, consolidated. RFC [ In reply to ]
In <9509141458.aa26125@post.demon.co.uk>
On Thu, 14 Sep 1995 15:00:31 +0100
Tim Bunce <Tim.Bunce@ig.co.uk> writes:
>> From: Nick.Ing-Simmons@tiuk.ti.com
>>
>> >Unfortunately, the better syntax to insure inheritance (sorry I missed this
>> >one, Larry) and namespace isolation is Tk->Pack::info($w), which is pretty
>> >different from existing syntax.
>>
>> It also does not do anything for namespace isolation, as I understand it
>> once there is a :: in the name then perl abandons inheritance and uses
>> thing to right of -> as fully qualified name.
>
>Nope. Perl uses the fully qualified package name on the right of a ->
>as the name of the class to _start_ looking for the method in. It
>continues up the @ISA tree from there.
>
I stand corrected, and that is better than I expected.

However, it still is not influenced by left hand side of ->

So if Pack::info exists, Tk->Pack::info($w) is still going to
call Pack::info not Tk::Pack::info
Re: Tk Re: Name change list, consolidated. RFC [ In reply to ]
In <9509141727.AA04978@scalpel.netlabs.com>
On Thu, 14 Sep 95 10:27:42 -0700
Larry Wall <lwall@scalpel.netlabs.com> writes:
>: We are getting bogged down in jargon...

>
>Uh, no, Tk->Pack::info($w) still does inheritance. It just says to
>*start* looking in package Pack for the method, but the info method
>could be in any of Pack's base classes. It does override the
>"virtuality" of the method though.

Thanks to you and Tim for correcting me. I have a feeling I have
actually *used* the inheritance somewhere in Tk.

....
>
>: >The object->method syntax seems to lead
>: >people into thinking that every method HAS to be virtual. I'm not sure about
>: >perl, but static methods are much faster than virtual methods in most other
>: >(all other???) languages. Then again, I'm writing this at 7:00 AM, so rational
>: >thought is likely to be virtual as well.
>: >
>
>The only way the $obj->Package::method() syntax might run faster is
>that it might cut down the search tree on initial (that is, on
>uncached) calls. The only way to get a direct call in Perl is with the
>ordinary subroutine call syntax, Pack::info("Tk", $w). Though I suppose
>one might write it, Pack::info(Tk => $w), just to be garish.
>
>Or maybe you guys are talking about something else. These terms are
>slippery...
>
Exactly what I meant by getting bogged down in jargon.