-
Notifications
You must be signed in to change notification settings - Fork 587
op.c auto-use attributes.pm; newSVpvs("attributes") -> newSVpvs_share() #23424
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
Open
bulk88
wants to merge
1
commit into
Perl:blead
Choose a base branch
from
bulk88:op_c_attributes_auto_use_auto_load_add_SV_HEK_COWs_for_pkg
base: blead
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
The commit message is not comprehensible to me.
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.
Do you have a suggestion something better than my wording of "op.c auto-use attributes.pm;"?
I have no preference on the wording of the commit title. Its for future ppl who are not me to read.
There are 3 different places in op.c that do C level equivalent of PP
use attributes;
orrequire attributes;
every time they executevoid Perl_apply_attrs_string(pTHX_ const char *stashpv, CV *cv, const char *attrstr, STRLEN len)
void S_apply_attrs_my(pTHX_ HV *stash, OP *target, OP *attrs, OP **imopsp)
void S_apply_attrs(pTHX_ HV *stash, SV *target, OP *attrs)
What would you call the
use attributes; from C
feature in them? I can't think of anything better than "auto-use" and just writing "use attributes" is too confusing, PP level? C level? the keyword "use" or "use the attributes API"?I know "auto-use Foo.pm;" means somewhere
Perl_load_module()
is going to be called. But I think nobody knows whatPerl_load_module()
is or does off the top of their head. Its super rare for me seePerl_load_module()
anywhere in core or CPAN XS.I believe its not a day 1 Perl API call and was added in the 5.6.x era or 5.9.x or 5.10.x or 5.12.x era, because predecessor
void Perl_require_pv(pTHX_ const char *pv)
was a very quick hack job that wakes up the yylexer API.perl5/perl.c
Line 3517 in 94b9bf6
and I think XS devs are afraid of
Perl_load_module()
because it is the 1 and only function call in the entire Public API takes over ownership of the callersSV*
, excluding very obvious and very basichv_store()
/av_store()
calls.Perl_load_module()
is also "too cool for school" to a CPAN XS person, since its C code looks like the output ofB::ByteLoader
or the output ofB::C
orB::CC
.perl5/op.c
Line 8471 in 94b9bf6
I dont mind it being copy pasted
"B:CC"
codegen, its a smart and faster design choice than parsing an ASCII string . ButPerl_load_module()
scares off 90% of high skill set CPAN XS/C devs, IDK why,Perl_load_module()
just does. So b/c is so rarely used by Perl XS ppl, I didn't want to put its name in a commit title.Perl C ppl don't remember what it does off the top of their head, so I would be making a future reader who reads the title, searching for "what commit could be causing my Zoo bug in the interp's Foo subsystem?", waste time reading its diff code, or just reading the title only and then spend 30 seconds greping
perlapi
andperlguts
to remember what it actually does. I know everyone knows whatuse attributes;
does and can keep scrolling the git log with the mouse wheel. Commit titleop.c: Perl_load_module(): newSVxxv() -> newSVyyv()
is useless without opening it.So I thought a "PP" worded title like
"op.c auto-use attributes.pm; newSVpvs("attributes") -> newSVpvs_share()"
is much better than writing a title like"op.c Perl_load_module(), newSVpvs("attributes") -> newSVpvs_share()"
which nobody knows what on earth this commit is doing inside ofop.c
without opening it becauseop.c
is as huge as beach but with code instead of sand and every commit is the size of dime.I think "auto-use attributes.pm;" best describes the "location" or "area" of
op.c
being touched with GPS level accuracy, writingis too long to be a commit title and unreadable except for the most hard core C devs at P5P, and I try to consider readability of a title for non-C ppl so `"op.c: auto-use attributes;" sounds friendly to read vs the way too list of C symbols above.