-
Notifications
You must be signed in to change notification settings - Fork 559
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
Introduce symbol table API into pad #22850
Open
happy-barney
wants to merge
41
commits into
Perl:blead
Choose a base branch
from
happy-barney:hpb/symbol-table
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
Conversation
This file contains 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
happy-barney
force-pushed
the
hpb/symbol-table
branch
from
December 9, 2024 23:05
51e4140
to
9719855
Compare
…fication Using dedicated C tokens instead of literal values will improve readability of source code by separating intention from other usages of literal characters: - sigil (as language structure) - predefined variable name - prototype It will also make it feasible to add functionality, like - new sigil-less symbol tables (attributes, patterns, contracts, ...) - add support for custom symbol tables
…m symbol table Returns true value when provided `PADNAME *` represents symbol belonging to provided symbol table.
By wrapping implementation into single intent expressing token it can evolve without affecting its usage.
Using macro instead of direct access: - identifies code where such value is used / required - hides any future changes from code which uses it, eg - type change from 'char' to 'U32'
Returns name without symbol type so it will properly work when we will change symbol table id type or when we will add new symbol types. For backward compatibility user of this macro can rely on -1 being valid index.
stored in pad, excluding symbol table id (sigil) eg: - `$` => 0 - `$_` => 1 - `$self` => 4
into handy macros to avoid code duplication as well as simplify future changes.
eg: scalar, array, and hash are "variable"
Move printf format and proper expansion of parameters, into macros so when code evolves, it will be isolated from usage.
extracting common part of condition and using `Perl_Symbol_Table_*` constants
…nts first Common problem is when macro expands as multiple arguments. Without intermediate step allowing to expand arguments before macro call there will be an error due treating such expansion as single argument.
to improve readability of what is actually tested
There were two instances of same condition. From code looking like 3-state dispatch I guess it was meant to be `1`
happy-barney
force-pushed
the
hpb/symbol-table
branch
from
December 10, 2024 10:52
9719855
to
7f7f7c7
Compare
What is the point of this very large change? AFAICT, it's not a bug fix or a response to an open issue. Does it respond to some previously expressed need? |
@jkeenan already discussed that on IRC, this PR is quite huge, it in fact combines parts of 3 changesets (in my eyes, maybe more by someone else) I will extract first two changes into separated PRs, each announced first for discussion on mailing list. |
Sign up for free
to 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.
Changes summary
For purpose of this changes let's distinguish between:
For implementation of sigil-less symbols we will still need their symbol type, eg:
replace literals representing type of symbol stored in pad with explicit tokens
For example,
'&'
in code can mean also:This set of changes replaces its usage as symbol type with C token
Perl_Symbol_Table_Code
.Extend padname API with "split" macros
Instead of relying on layout of string content explicit macros providing symbol type and symbol name are introduced, eg:
Provide padname functions with split symbol type and symbol name parameters
Alternatives to existing functions but with two parameters.
Example:
Possible follow-ups
Perl_Var_Match
Perl_Prototype_Code
Open questions
perldelta
?