develooper Front page | perl.perl5.porters | Postings from February 2018

Re: [perl #132902] Blead Breaks CPAN: Class::Std

Thread Previous
February 24, 2018 23:50
Re: [perl #132902] Blead Breaks CPAN: Class::Std
Message ID:
On 25 Feb 2018 02:01, "Father Chrysostomos via RT" <> wrote:

On Sat, 24 Feb 2018 04:16:48 -0800, demerphq wrote:
> On 24 February 2018 at 12:32, demerphq <> wrote:
> > On 24 February 2018 at 03:46, demerphq <> wrote:
> >> On 24 February 2018 at 03:44, Zefram <> wrote:
> >>> demerphq wrote:
> >>>> Thanks, this looks like fallout from a fix I pushed yesterday.
> >>>
> >>> Confirmed: it bisects to commit
> >>> c99363aa273278adcad39f32026629b700f9bbc3
> >>> "fix Perl #132828 - dont use overload to bypass overloads".  The
> >>> relevant
> >>> part of Class::Std is overriding UNIVERSAL::can.
> >>
> >> Which means its Class::Std's fault for not implementing can
> >> properly.
> >>
> >> Nevertheless I will find a fix.
> >>
> >> Thanks for verifying and the analysis Zefram.
> >
> > I have created a pull request against Class::Std to fix this.
> >
> >
> >
> > I also will push a patch to fix this in as well.
> Fixed in 17157c41e6523264e0f5e7d4baa490a1a8f2322b

I don’t like the current state of the code in, but I can’t say I
have a better suggestion off the top of my head.  I have not thought it
through thoroughly yet.  Let me just outline my concerns, before I forget
them, and later if I have time I might come up with a patch:

if ($in_recurse || do{ local $in_recurse = 1; $pack->can("((") }) {

This will only work on newer perls (5.16+ iirc), since older ones used (),
not ((.  And I think even current perl allows XS modules to register
overloading via just (), without ((.  I need to check.

We can add a check for () as well.

‘can’ is really not the right thing to use.

Can you explain why? Since overloads are inherited it seems there is no

  Overriding ‘can’ makes sense in the presence of AUTOLOAD, but since
overloading bypassing AUTOLOAD, it should be bypassing ‘can‘ as well.  This
is why implements its own ‘can’.  Perhaps should be
loaded unconditionally when Carp is loaded (it is more lightweight than
Carp, after all).  Then theoretically one could use overload::Overloaded,
but unfortunately old versions have the same ‘can’ bug that will cause the
recursion.  Maybe calling overload::mycan directly is the solution.

If Carp unilaterally loads overload we don't need to use can at all. The
only reason we use it is to avoid loading overload when we don't need to.

I already suggested that this policy was counter productive and the only
reason I didn't change was that you expressed an opinion that we should be
able to keep it.

If you no longer care about loading overload then the patch becomes trivial.

This is a real can of worms.

A real mycan of worms?



Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About