-
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
Setting $[ = 0 should not generate a warning #15107
Comments
From @jimavThis is a bug report for perl from jim.avera@gmail.com, perl -we 'local $[ = 0;' This warning makes some old code noisy even if the only thing the code does An example is the html2ps utility distributed with Ubuntu (in this particular Regardless, it would be nice if the warning was only issued when $[ is set to Flags: Site configuration information for perl 5.20.2: Configured by Debian Project at Thu May 14 17:30:11 UTC 2015. Summary of my perl5 (revision 5 version 20 subversion 2) configuration: Locally applied patches: @INC for perl 5.20.2: Environment for perl 5.20.2: |
From @jkeenanOn Mon Dec 28 14:19:28 2015, jim.avera@gmail.com wrote:
To facilitate discussion of this ticket, here's the current documentation in blead pod/perlvar.pod for $[: ########## As of release 5 of Perl, assignment to C<$[> is treated as a compiler Prior to Perl v5.10.0, assignment to C<$[> could be seen from outer lexical As of Perl v5.16.0, it is implemented by the L<arybase> module. See Under C<use v5.16>, or C<no feature "array_base">, C<$[> no longer has any Mnemonic: [ begins subscripts. Deprecated in Perl v5.12.0. Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From [email protected]
It is not possible in Perl 5. $[ has been lexically scoped since 5.000. -zefram |
From @LeontOn Tue, Dec 29, 2015 at 1:33 AM, Zefram <zefram@fysh.org> wrote:
Actually, I think a2p can still output $[ = 1, and that may have been the Leon |
From [email protected]Leon Timmermans wrote:
No, I fixed that six years ago. We then removed from the core the ability -zefram |
From @ap* Zefram <zefram@fysh.org> [2015-12-29 01:35]:
The only purpose of warning about `$[ = 0` is if there were plans to Otherwise there is no point in bugging users about the fact that the That sort of thing belongs in a linter to inform the programmer writing Strictly speaking this is even true of `$[ = 1` but that does actually Regards, |
From @LeontOn Tue, Dec 29, 2015 at 10:14 PM, Zefram <zefram@fysh.org> wrote:
I know, I did that myself! :-p Leon |
From @tonycozOn Thu Dec 31 04:33:34 2015, aristotle wrote:
The attached suppresses the warning. It doesn't prevent arybase from being loaded, but arybase won't do its Whether this should ba applied.... I'm more of the mind of removing $[ completely, but didn't speak up when Tony |
From @tonycozOn Sun Jan 03 16:16:17 2016, tonyc wrote:
Now with actual attaching! Tony |
From @tonycoz0001-perl-127063-suppress-warning-on-assigning-0-to.patchFrom c38016329d24687f91b38925c33b1dd57d79681c Mon Sep 17 00:00:00 2001
From: Tony Cook <[email protected]>
Date: Mon, 4 Jan 2016 11:13:19 +1100
Subject: [perl #127063] suppress warning on assigning 0 to $[
---
ext/arybase/arybase.pm | 2 +-
ext/arybase/arybase.xs | 11 +++++++----
t/lib/warnings/op | 1 +
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/ext/arybase/arybase.pm b/ext/arybase/arybase.pm
index a519a4b..64efe3e 100644
--- a/ext/arybase/arybase.pm
+++ b/ext/arybase/arybase.pm
@@ -1,6 +1,6 @@
package arybase;
-our $VERSION = "0.11";
+our $VERSION = "0.12";
require XSLoader;
XSLoader::load(); # This returns true, which makes require happy.
diff --git a/ext/arybase/arybase.xs b/ext/arybase/arybase.xs
index 4ff6cbd..c0673fe 100644
--- a/ext/arybase/arybase.xs
+++ b/ext/arybase/arybase.xs
@@ -165,11 +165,14 @@ STATIC void ab_process_assignment(pTHX_ OP *left, OP *right) {
#define ab_process_assignment(l, r) \
ab_process_assignment(aTHX_ (l), (r))
if (ab_op_is_dollar_bracket(left) && right->op_type == OP_CONST) {
- set_arybase_to(SvIV(cSVOPx_sv(right)));
+ IV base = SvIV(cSVOPx_sv(right));
+ set_arybase_to(base);
ab_neuter_dollar_bracket(left);
- Perl_ck_warner_d(aTHX_
- packWARN(WARN_DEPRECATED), "Use of assignment to $[ is deprecated"
- );
+ if (base) {
+ Perl_ck_warner_d(aTHX_
+ packWARN(WARN_DEPRECATED), "Use of assignment to $[ is deprecated"
+ );
+ }
}
}
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index 89de94f..2a3eeeb 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -1750,6 +1750,7 @@ $[ = 1;
use warnings 'deprecated';
$[ = 2;
($[) = 2;
+$[ = 0;
no warnings 'deprecated';
$[ = 3;
($[) = 3;
--
2.1.4
|
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127063 (status was 'resolved')
Searchable as RT127063$
The text was updated successfully, but these errors were encountered: