Skip to content
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

perlvar.pod - add "Scoping Rules of Regex Variables" section #20791

Merged
merged 1 commit into from Feb 12, 2023

Conversation

demerphq
Copy link
Collaborator

This section is used to document the majority of the regex variables, and previous language referring to them as "dynamically scoped" has been changed or simplified and a link to the new section provided to centralize the explanation.

Strictly speaking $1 is globally scoped, but the data it access is dynamically scoped such that successful matches behave as though they localize a regex match state variable. (Maybe one day we will actually have such a variable exposed to the user.)

This patch addss links to the relevant docs in perlsyn and perlvar to various places where it seemed appropriate, and also cleans up the wording for most cases to be similar or identical across all uses. It also cleans up a bit of related language in nearby paragraphs where it seemed to improve the readability of the docs.

It also replaces the older kind of confusing example code for understanding the behavior and documents that "goto LABEL" does not play nicely with the dynamic scoping.

This fixes Github Issue #899.

@demerphq
Copy link
Collaborator Author

demerphq commented Feb 10, 2023 via email

@demerphq
Copy link
Collaborator Author

@khwilliamson I tweaked the verbiage a touch more, are you still ok with this?

pod/perlvar.pod Outdated Show resolved Hide resolved
pod/perlvar.pod Outdated Show resolved Hide resolved
This section is used to document the majority of the regex
variables, and previous language referring to them as "dynamically
scoped" has been changed or simplified and a link to the new
section provided to centralize the explanation.

Strictly speaking $1 is globally scoped, but the data it access
is dynamically scoped such that successful matches behave as
though they localize a regex match state variable. (Maybe one
day we will actually have such a variable exposed to the user.)

This patch adds links to the relevant docs in perlsyn and perlvar
to various places where it seemed appropriate, and also cleans up
the wording for most cases to be similar or identical across all
uses. It also cleans up a bit of related language in nearby paragraphs
where it seemed to improve the readability of the docs.

It also replaces the older kind of confusing example code for
understanding the behavior and documents that "goto LABEL" does
not play nicely with the dynamic scoping.

This fixes Github Issue #899.
@demerphq demerphq force-pushed the yves/regexp_dynamic_vars_doc_improvement branch from 333c5c0 to 214db36 Compare February 12, 2023 12:34
@demerphq demerphq merged commit 2a51adc into blead Feb 12, 2023
@demerphq demerphq deleted the yves/regexp_dynamic_vars_doc_improvement branch February 12, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants