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
[PATCH] perlop: words before a fat arrow comma can start with - #16855
Comments
From dot@dotat.atThis is a bug report for perl from dot@dotat.at, I was checking whether '-' is allowed inside barewords before Flags: Site configuration information for perl 5.29.9: Configured by fanf2 at Fri Mar 1 16:47:41 GMT 2019. Summary of my perl5 (revision 5 version 29 subversion 9) configuration: Locally applied patches: @INC for perl 5.29.9: Environment for perl 5.29.9: |
From dot@dotat.at0001-perlop-words-before-a-fat-arrow-comma-can-start-with.patchFrom ab9c75bb9b8c06b34fb988bdd5170b0976b38cbb Mon Sep 17 00:00:00 2001
Message-Id: <ab9c75bb9b8c06b34fb988bdd5170b0976b38cbb.1551458815.git.dot@dotat.at>
From: Tony Finch <dot@dotat.at>
Date: Fri, 1 Mar 2019 16:42:12 +0000
Subject: [PATCH] perlop: words before a fat arrow comma can start with -
---
pod/perlop.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pod/perlop.pod b/pod/perlop.pod
index af695b678f..5b6c391b5d 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1250,7 +1250,7 @@ from left to right.
The C<< => >> operator (sometimes pronounced "fat comma") is a synonym
for the comma except that it causes a
word on its left to be interpreted as a string if it begins with a letter
-or underscore and is composed only of letters, digits and underscores.
+or underscore or minus and is composed only of letters, digits and underscores.
This includes operands that might otherwise be interpreted as operators,
constants, single number v-strings or function calls. If in doubt about
this behavior, the left operand can be quoted explicitly.
--
2.18.0
|
From @jkeenanOn Fri, 01 Mar 2019 17:39:21 GMT, dot@dotat.at wrote:
Could you prepare a patch (probably in pod/perlop.pod) for the change of documentation you would like to see? (Patches are best prepared in a git checkout of the Perl 5 respository, using 'git format-patch'. However, 'patch' and 'diff' also can be used.) Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Fri, 01 Mar 2019 09:39:21 -0800, dot@dotat.at wrote:
The - isn't part of the bareword, the -foo => ... results in the unary negation operator being applied to the foo bareword: tony@mars:.../git/perl$ ./perl -Dt -e '-foo => 1' EXECUTING... (-e:0) enter This is documented in perlop: Unary C<"-"> performs arithmetic negation if the operand is numeric, Tony |
From dot@dotat.at
Yep, done, and attached to the report using perlbug as described in https://perldoc.perl.org/perlhack.html#PATCHING-PERL Tony. |
From dot@dotat.at
Yep, that’s kind of right, and I explained that in my bug report, but the documentation is still incomplete and confusing and does not match the special case for -bareword=> in toke.c. See https://perl5.git.perl.org/perl.git/blob/HEAD:/toke.c#l5666for the code that implements the special case for - before a bareword before => This code overrides the bit of the documentation which says barewords before => override all operator precedence. See https://perl5.git.perl.org/perl.git/blob/HEAD:/pod/perlop.pod#l1280 So if I am looking up the syntax for what appears before => in the current docs I need to know that “bareword” is jargon for “interpreted as a string” (but the explanation of => does not mention “bareword”) and I need to know that the explanation for how the - operator works on barewords is not just a property of the operator, but also a property of the lexical syntax that has an undocumented special case before => Tony. |
Migrated from rt.perl.org#133873 (status was 'open')
Searchable as RT133873$
The text was updated successfully, but these errors were encountered: