- Notifications
You must be signed in to change notification settings - Fork602
mark CORE::__CLASS__ as non-ampable#23740
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Previously: CORE::__CLASS__ and compile-time aliasing (as in `BEGIN {*cls = \&CORE::__CLASS__; } ... cls`) worked as expected, but runtimecalls like `&CORE::__CLASS__()` and `my $ref = \&CORE::__CLASS__; ...$ref->()` would produce bizarre results, behaving like CORE::__FILE__instead.Now the latter throw a "&CORE::__CLASS__ cannot be called directly"error. This is perhaps not entirely satisfactory, but __CLASS__ is a bitspecial (it is not a true constant and only usable in methods) anderroring cleanly is better than silently returning wrong results.FixesPerl#23737.Assorted changes:- Document core_prototype()'s `opnum` parameter.- Add comment explaining what `*opnum = 0` means (and why it makes no sense for KEY___CLASS__).- Don't hardcode assumptions about keyword codes in coresub_op(). Handle __PACKAGE__/__FILE__/__LINE__ explicitly and assert() nothing else is passed in. This effectively reverts commitc2f605d.- Remove CORE::__CLASS__ from op/coreamp.t as it is no longer "ampable".- Extend op/coresubs.t to handle more of the idiosyncrasies of CORE::__CLASS__.Rearrange documentation slightly to make it clearer what you can(not) dowith CORE::chomp, CORE::chop, etc. and add CORE::__CLASS__ to the list.
coresub_op() no longer hardcodes assumptions about the numeric values of__FILE__, __LINE__, __PACKAGE__ keyword symbols.
Contributor
leonerd left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Overall LGTM, but I'd suggest some adjustment to the perldelta.
Uh oh!
There was an error while loading.Please reload this page.
c7d59f7 to053aa58CompareUh oh!
There was an error while loading.Please reload this page.
d143571 intoPerl:blead 33 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously:
CORE::__CLASS__and compile-time aliasing (as inBEGIN { *cls = \&CORE::__CLASS__; } ... cls) worked as expected, but runtime calls like&CORE::__CLASS__()andmy $ref = \&CORE::__CLASS__; ... $ref->()would produce bizarre results, behaving likeCORE::__FILE__instead.Now the latter throw a
&CORE::__CLASS__ cannot be called directlyerror. This is perhaps not entirely satisfactory, but__CLASS__is a bit special (it is not a true constant and only usable in methods) and erroring cleanly is better than silently returning wrong results.Fixes#23737.
Partially subsumes#23343.