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
sort CONSTANT exhibits weird behavior #7979
Comments
From @fbriereCreated by @fbriere $ perl -le 'use constant NUMBERS => qw(one two three); print sort NUMBERS' $ perl -le 'use constant NUMBERS => qw(one two three); print sort NUMBERS()' $ perl -le 'use constant NUMBERS => qw(one two three); print sort (NUMBERS)' $ perl -le 'use constant NUMBERS => qw(one two three); print sort (NUMBERS())' (I imagine case #2 is related to ticket #30377.) Perl Info
|
From @dcollinsndcollins@nightshade64:~/toolchain$ perl5.25.2 -MO=Deparse -le 'use constant NUMBERS => qw(one two three); print sort NUMBERS;' It's being interpreted as a bareword for some reason? |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Thu Jul 07 17:58:18 2016, dcollinsn@gmail.com wrote:
Oh, what fun! This is a very old bug. And it occurs because of the way that the parser gets to decide whether the first token after ‘sort’ is a comparison sub or part of the list to sort. The lexer (toke.c) assumes that any word immediately following ‘sort’ is a comparison sub, which gets emitted as a WORD token, just like a bareword. It is the parser (perly.y) that distinguishes between these two: sort foo bar So the lexer does not actually know at the time whether the word will be a comparator or not. That makes it hard to fix. (All of this is from memory. I may be getting some of it wrong.) use constant{Just=>another=>Perl=>hacker=>};$\=",\n"; -- Father Chrysostomos |
Migrated from rt.perl.org#36333 (status was 'open')
Searchable as RT36333$
The text was updated successfully, but these errors were encountered: