New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating accessor method using SUPER name stopped to work #13783
Comments
From migo@freeshell.orgThe following test program demonstrates a regression in perl 5.18: @Class2::ISA = qw(Class1); Class2->Class2::SUPER::a; In perl versions prior to 5.18.0 it prints: autoloaded In 5.18.0 (and 5.18.2) it prints "autoloaded" 3 times in a row. Best regards, Mikhael |
From @tonycozOn Tue Apr 29 15:13:01 2014, migo@freeshell.org wrote:
Bisected to: aae4380 is the first bad commit [perl #114924] Make method calls work with ::SUPER packages |
The RT System itself - Status changed from 'new' to 'open' |
From @rjbsThis seems like a 5.22.0 blocker, and something we'd want to backport when fixed. Agreed? |
From @tonycozOn Sun Jul 13 11:27:34 2014, rjbs wrote:
I'm not sure it's fixable without reverting the patch that changed the behaviour. Both before and after the patch, $Class2::AUTOLOAD is set to "Class2::SUPER::a" for the SUPER call: # system perl is 5.14.2 tony@mars:.../git/perl2$ ~/perl/5.20.0-dbg/bin/perl ../super-autoload.pl Before the patch, perl used *{"${package}::SUPER"} as a cache for SUPER lookups, so the assignment to *{$Class1::AUTOLOAD} updated the cache directly. The next call to SUPER::a finds the entry in the cache and everything (sort of) works. After the patch, perl no longer looks in *{"${package}::SUPER"}, so the second call doesn't find the entry the first call added. One solution might be to not paste "SUPER::" into $AUTOLOAD: --- a/gv.c but this doesn't restore the old behaviour: tony@mars:.../git/perl2$ ./perl ../super-autoload.pl It removes the ability to distinguish between SUPER and non-SUPER calls (if that's useful at all.) Tony |
From @rjbs* Tony Cook via RT <perlbug-followup@perl.org> [2014-07-14T21:33:11]
Thanks, that's all useful information that I will have to digest. What a mess. :( SUPER! Anybody else want to throw opinions in here? -- |
From @ikegamiOn Mon, Jul 14, 2014 at 9:33 PM, Tony Cook via RT <perlbug-followup@perl.org
[...]
You're calling Class1::a, not calling Class2::a. That seems worse. |
From @rjbsI don't have any solution to offer to restore the old behavior without reintroducing old problems. What would we want out of a solution to this moving forward? If we want to install the method that was autoloaded, there are two likely candidates for where to install it: 1) the package where the called AUTOLOAD was called The first can be done, generally, by having AUTOLOAD use __PACKAGE___. The second is more of a problem, here, because of the inherent ambiguity between SUPER and SUPER. We could provide (say) *AUTOLOAD to which a subroutine to be installed at the original call site could be assigned. We could provide a means to get the resolved package we're trying to look in (ParentClass instead of ChildClass::SUPER for when AUTOLOAD is in GrandParentClass). It is unfortunate that this changed without our noticing or issuing a notice, but I'm not eager to vacillate between two buggy states if we can provide better. -- |
Migrated from rt.perl.org#121766 (status was 'open')
Searchable as RT121766$
The text was updated successfully, but these errors were encountered: