-
Notifications
You must be signed in to change notification settings - Fork 577
possible documentation error in perldata #16288
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
Comments
From [email protected]This is a bug report for perl from calestyo@scientia.net, Hi. https://perldoc.perl.org/perldata.html says:
This seems to be wrong, in the sense, that the list E.g. Loading DB routines from perl5db.pl version 1.51 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): 1 DB<2> @b=(1, 2, @a); DB<3> print "@b"; DB<5> print "$b"; DB<7> $b=(1, 2, @a); DB<8> print "$b"; When doing $b=(1, 2, @a); the list is evaluated in scalar context Cheers, Flags: Site configuration information for perl 5.26.1: Configured by Debian Project at Tue Nov 28 17:44:14 UTC 2017. Summary of my perl5 (revision 5 version 26 subversion 1) configuration: Locally applied patches: @INC for perl 5.26.1: Environment for perl 5.26.1: |
From @iabynOn Wed, Dec 06, 2017 at 06:02:52PM -0800, via RT wrote:
It does by definition:
No, in scalar context, there isn't a list; instead there is merely -- |
The RT System itself - Status changed from 'new' to 'open' |
From [email protected]Le 08/12/2017 à 10:12, Dave Mitchell a écrit :
FWIW I find the sentence above clearer than the current wording in perldata 677 =head2 List value constructors YMMV. From experience this is a significant hurdle for beginners. @array = (...): # OK |
From [email protected]On Fri, 2017-12-08 at 01:12 -0800, Dave Mitchell via RT wrote:
That's at least not how the text in perldata or perlop does it make - (x, y, z) seems to be clearly what is defined to be a list, every So conceptually it still seems to be a list, and then the text that I Cheers, |
From @GrinnzOn Sat, Dec 9, 2017 at 11:11 PM, Christoph Anton Mitterer <
The definition of 'list' in perl is more precise than that. In scalar -Dan |
Is this closable? |
I think the OP has a point that this is a painful point for beginners and we could do better at documenting it, but there is no proposed language change, and the wording of the ticket isn't really correct. I think we could close it and create a new ticket that is more clear about what needs to be done. |
BTW, this language in perldata:
seems to contradict what @iabyn and @Grinnz say in this ticket. I am not arguing with their interpretation which I agree with in principal, but it seems a slippery ground. Most people would say:
is a |
I suppose you could call it syntactically/visually a list, but functionally no list is formed by the comma operator in that context. As a similar example |
If you're referring to |
On Tue, 19 Apr 2022 at 18:33, Dan Book ***@***.***> wrote:
If you're referring to In a context not requiring a list value, the value
of what appears to be a list literal is simply the value of the final
element, as with the C comma operator. - if anything it could be clearer
which operators it's talking about, it only calls out arrays specifically
after but there are some other exceptional cases. But really this section
is about lists, so I don't think it's necessary for it to go too in depth
about scalar context.
Yeah, to me the "what appears to be a list literal" supports the notion
that even thought
$x= (1,2,3);
looks like a list constructor it is not.
My question was actually: do you agree given that clause that we can close
the ticket?
…--
perl -Mre=debug -e "/just|another|perl|hacker/"
|
Yes, I think it is sufficiently covered though improvements are always welcome |
Migrated from rt.perl.org#132537 (status was 'open')
Searchable as RT132537$
The text was updated successfully, but these errors were encountered: