This commit is mostly a manual reversion of commit f1cf82e. Return to
using a perl_croak in universal.c; adjust regen/warnings.pl as needed; run 'make
regen'; get t/op/universal.t passing. No documentation changes yet.
Add test for undefined unimport method, then refactor repeated code into
a subroutine. Perform a pattern match rather than a string equality
test because testing for exact line numbers inside a test program is too
fragile for maintenance purposes.
'mispelled' was misspelled in one location; correct. Suppress 'used
only once' warning in one location. POD formatting improvements as
suggested by Elvin Aslanov, with one other word change.
Correct case of one character in error message so that it's the same in
both universal.c and pod/perldiag.pod. This enables us to preserve
status of universal.c in t/porting/diag.t. Per: Tony Cook review.
Rebasing on blead in the wake of d306795336, meant that merge conflicts
appeared, which necessitated two rounds of running 'make regen'.
Simplify test_undefined_method(). Update entry in
pod/perldeprecation.pod.
For: GH #23623
* Adapt all tests.
* Revise discussion of 'goto' in perlfunc.
* Perl 5.44 fatalization: document goto_construct Also, note that no
deprecations or fatalizations occurred in perl-5.42.
* Remove 'goto_construct' from list of warnings. This entails:
** Entering 'deprecated::goto_construct" into %NO_BIT_FOR inside
regen/warnings.pl;
** Incrementing $VERSION in that file;
** Running `make regen` to propagate these changes to lib/warnings.pm and
warnings.h, in the process renumbering the warnings categories and
adding 'deprecated::goto_construct' to %NoOp inside lib/warnings.pm.
* Add entry to perldiag.pod
* Update perldelta: partial fatalization of goto construct.
* t/op/goto.t: Restore tests deleted during work on branch.
This adds a major new ability to subroutine signatures, allowing callers
to pass parameters by name/value pairs rather than by position.
sub f ($x, $y, :$alpha, :$beta = undef) { ... }
f( 123, 456, alpha => 789 );
Originally specified in
https://github.com/Perl/PPCs/blob/main/ppcs/ppc0024-signature-named-parameters.md
This feature is currently considered experimental.
As these only permit `any BLOCK LIST` and not the deferred-expression
form like `grep EXPR, LIST`, we create a whole new token type, BLKLSTOP,
to represent these. The parser then only accepts the block form and not
the expression form when parsing these.
I'm a little hesitant over the removal of the warning identifier,
since it means code that suppressed the warning in 5.38 and 5.40 will
now see an error, but porting/deprecation complained when I removed
the documentation from pod/perldeprecation.pod but left the warning
in.
An alternative would be to add a "Cancelled Removals" to
perldeprecation.
We have had a LOT of fallout from 2dcf3cf50d7 as it turns out that
there various common cases of people accidentally exploiting the
silent use of missing import with arguments. The premise of detecting
this was that it would allow us to detect scenarios where users
on a case-insensitive file-system had a typo. But it turns that there
are a lot of accidental cases of this as well, a lot more than we
expected.
Common mistaken cases are:
* Via use_ok() where people think the second argument is a test
name instead of an argument to the import of the module being
used.
* Using a quoted version number in a version check instead of a true
number. IE:
use Foo '1.234';
gets passed to Foo->import() and not Foo->VERSION(). This is
compounded by the fact that Exporter->import() *does* support a
version check via import(). Arguably if we allow string versions
(IMO we should) then we should deal with this in the parser, not
in import() (although the latter is a little more debatable IMO).
* Explicit calls to import() with a version number.
* Mistakenly requesting an export from a module that doesn't
actually export anything. One possible explanation for this case
is that a module was at one point in its lifetime not a class, but
then was later on turned into a class and the arguments to use
statements weren't changed even though the main code was
changed to use class syntax.
Because of the scope of the breakage of the original error this patch
downgrades the error to a depecation warning instead, with the intention
that in 5.44 we will make it a hard error.
- fix a couple of typos;
- clarify that 'use warnings' enables even warnings that have not yet
been registered;
- rename function name in an example, since a later reference relates
to the same function from a previous example;
- link to a more specific point from warnings::register
I am surprised I had to bump the version here, but porting/cmp_version
complained, because of this:
# Version number (1.64) unchanged since v5.37.11, but contents have changed:
#
# diff --git a/lib/warnings.pm b/lib/warnings.pm
# index 739b51a0ac..45532dd45a 100644
# --- a/lib/warnings.pm
# +++ b/lib/warnings.pm
# @@ -129,7 +129,7 @@ our %Offsets = (
# # Warnings Categories added in Perl 5.037009
# 'deprecated::apostrophe_as_package_separator'=> 156,
#
# - # Warnings Categories added in Perl 5.03701
# + # Warnings Categories added in Perl 5.038
# 'deprecated::smartmatch' => 158,
# );
This feels like a bit of the regen code that I don't understand. I'm
making this patch at least tentatively to try to get tests all passing.
Some delimiters are considered deprecated because in the future they
will be used as part of a paired delimiter. This adds a new category
for these cases.
This category is only used in the regex engine, we should be able
to disable it specifically, as it seems like we will never actually
remove demove support for the things it warns about.
Currently we seem to lack a way to have a subcategory under deprecated.
It seems reasonable to me that people might want to disable a specific
subcategory warning while leaving the rest in place. This patch allows
that. Note that both
no warnings "deprecated";
and
no warnings "deprecated::smartmatch";
work to disable the warning. Deprecated warnings shouldn't be "all or
nothing", they should be specific and targetted.
Multiple forms of syntax can be used to obtain a package name from
`caller`, which emits this as its first return value, and assign
that name to a lexical scalar.
The following each achieve the same result, but with varying efficiency:
* `sub callme { my $package = caller(2); ...}`
* `sub callme { my ($package) = caller(2); ...}`
* `sub callme { my $package = (caller(2))[0]; ...}`
In the first example, `pp_caller` determines only the package name
and pushes it to the stack. In the other two examples, the other 10 of
`caller`'s return values are calculated and pushed onto the stack,
before being discarded.
This commit changes non-CPAN-first instances of the latter two forms
in core to the first form.
Note: There is a special exception to the equivalence described above,
when caller is use in list context within the DB package. Such a
usage instance in regen/warnings.pl therefore remains unchanged.
This updates the mode-line for most of our generated files so that
they include file type information so they will be properly syntax
highlighted on github.
This does not make any other functional changes to the files.
[Note: Commit message rewritten by Yves]
Adds a new experimental warning, feature, keywords and enough parsing to
implement basic classes with an empty `new` constructor method.
Inject a $self lexical into method bodies; populate it with the object instance, suitably shifted
Creates a new OP_METHSTART opcode to perform method setup
Define an aux flag to remark which stashes are classes
Basic implementation of fields.
Basic anonymous methods.
`no warnings 'experimental::foo';` is effectively a no-op
if the `foo` feature is not experimental any more.
So, stop reserving bits in `${^WARNING_BITS}` for them,
and silently do nothing when they are enabled or disabled
via `use warnings` or `no warnings`.
Warnings turned into no-op in this commit:
* experimental::alpha_assertions
* experimental::bitwise
* experimental::isa
* experimental::lexical_subs
* experimental::postderef
* experimental::script_run
* experimental::signatures
These warnings are no longer generated; so simplify the core by not
trying to turn them off.
The warning is preserved so that other code need not change, but this
commit also turns the default generation of it off.
An unescaped right angle bracket was resulting in a malformed code snippet in warnings.pm
This tiny PR escapes that character and thus fixes the rendering.
regen/warnings.pl corrected and regenerated; version bumped.
Pete Houston is now a Perl Author.
For: https://github.com/Perl/perl5/pull/19228
Adds syntax `defer { BLOCK }` to create a deferred block; code that is
deferred until the scope exits. This syntax is guarded by
use feature 'defer';
Adds a new opcode, `OP_PUSHDEFER`, which is a LOGOP whose `op_other` field
gives the start of an optree to be deferred until scope exit. That op
pointer will be stored on the save stack and invoked as part of scope
unwind.
Included is support for `B::Deparse` to deparse the optree back into
syntax.