List Info

Thread: Re: mro "PERFORMANCE CONSIDERATIONS" still true?




Re: mro "PERFORMANCE CONSIDERATIONS" still true?
user name
2007-09-11 08:24:54
On 9/11/07, hvcrypt.org <hvcrypt.org> wrote:
> "Brandon Black" <blblackgmail.com> wrote:
> :[...] The behavior of the current base
> :and the proposed change is different even without
exceptions (although
> :in ways you wouldn't think a sane module would care
about, but
> :still...).  When you do the following with the current
base.pm:
> :
> :perl -wle 'package AA; ISA=(); package BB; use
base qw/AA/; package
> :CC; use base qw/BB AA/; package main; print join(q{,},
CC::ISA)'
> :
> :It prints just "BB".  CC::ISA does not contain
"AA" even though it
> :was explicitly asked for.  This is due to the
"next if
> :$inheritor->isa($base)" line.  With the
proposed push-all-at-once
> :logic, CC::ISA would instead be qw/BB AA/ as
asked for.
>
> I think that could be fixed just by replacing the check
with:
>   next if grep $_->isa($base), ($inheritor, isa_classes);
>

Hmmm yeah that should have the same effect as the original I
think.

-- Brandon

Re: mro "PERFORMANCE CONSIDERATIONS" still true?
user name
2007-09-11 10:51:13
On Sep 11 2007, Brandon Black wrote:
> On 9/11/07, hvcrypt.org <hvcrypt.org> wrote:
> > "Brandon Black" <blblackgmail.com> wrote:
> > :[...] The behavior of the current base
> > :and the proposed change is different even without
exceptions (although
> > :in ways you wouldn't think a sane module would
care about, but
> > :still...).  When you do the following with the
current base.pm:
> > :
> > :perl -wle 'package AA; ISA=(); package BB; use
base qw/AA/; package
> > :CC; use base qw/BB AA/; package main; print
join(q{,}, CC::ISA)'
> > :
> > :It prints just "BB".  CC::ISA
does not contain "AA" even though it
> > :was explicitly asked for.  This is due to the
"next if
> > :$inheritor->isa($base)" line.  With the
proposed push-all-at-once

Yes, I completely missed the significance of this line.

> > :logic, CC::ISA would instead be qw/BB AA/ as
asked for.
> >
> > I think that could be fixed just by replacing the
check with:
> >   next if grep $_->isa($base), ($inheritor,
isa_classes);
> >
> 
> Hmmm yeah that should have the same effect as the
original I think.

It would, although your point that some other MRO might get
tripped up
by this fudging of ISA is still valid.  And of course there's
still the
open question of how useful this optimization is anyway.

-- 
Rick Delaney
rickbort.ca

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )