Skip Menu |
Report information
Id: 130184
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: comdog <brian.d.foy [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] All digit words in angle-bracket word quoting don't come out the same as the literally quoted word
Date: Sat, 26 Nov 2016 18:46:37 -0500
To: rakudobug [...] perl.org
From: brian d foy <brian.d.foy [...] gmail.com>
Download (untitled) / with headers
text/plain 1.3k
Adapted from the Stackoverflow answer at: http://stackoverflow.com/a/40824226/2766176 I'm using moar (2016.10) on macosx (10.10.5) darwin (14.5.0) (These variables are quite nice!) This came out of a problem I had with set membership. It turns out that the way you make the set matters, and the way you make the candidate member matters. In my case, there's a bug with angle-bracket word quoting. I used the [angle-brackets form of the quote words](https://docs.perl6.org/language/quoting#Word_quoting:_qw). The quote words form is supposed to be equivalent to the quoting version (that is, True under `eqv`). Here's the doc example: <a b c> eqv ('a', 'b', 'c') But, when I try this with a word that is all digits, this is not equivalent: $ perl6 Show quoted text
> < a b 137 > eqv ( 'a', 'b', '137' )
False But, the other forms of word quoting are! Show quoted text
> qw/ a b 137 / eqv ( 'a', 'b', '137' )
True Show quoted text
> Q:w/ a b 137 / eqv ( 'a', 'b', '137' )
True The angle-bracket word quoting uses [IntStr](https://docs.perl6.org/type/IntStr): Show quoted text
> my @n = < a b 137 >
[a b 137] Show quoted text
> @n.perl
["a", "b", IntStr.new(137, "137")] Without the word quoting, the digits word comes out as [Str]: Show quoted text
> ( 'a', 'b', '137' ).perl
("a", "b", "137") Show quoted text
> ( 'a', 'b', '137' )[*-1].perl
"137" Show quoted text
> ( 'a', 'b', '137' )[*-1].WHAT
(Str) Show quoted text
> my @n = ( 'a', 'b', '137' );
[a b 137] Show quoted text
> @n[*-1].WHAT
(Str)
Download (untitled) / with headers
text/plain 257b
This appears to be a problem with the docs. In https://docs.perl6.org/language/quoting#Word_quoting:_qw , there's no mention of the special value processing. The current text strongly implies that <...> is the same qw//. There's no note about the :v adverb.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.8k
On Sat, 26 Nov 2016 15:47:38 -0800, comdog wrote: Show quoted text
> Adapted from the Stackoverflow answer at: > http://stackoverflow.com/a/40824226/2766176 > > I'm using moar (2016.10) on macosx (10.10.5) darwin (14.5.0) (These > variables are quite nice!) > > This came out of a problem I had with set membership. It turns out > that the way you make the set matters, and the way you make the > candidate member matters. In my case, there's a bug with angle-bracket > word quoting. > > I used the [angle-brackets form of the quote > words](https://docs.perl6.org/language/quoting#Word_quoting:_qw). The > quote words form is supposed to be equivalent to the quoting version > (that is, True under `eqv`). Here's the doc example: > > <a b c> eqv ('a', 'b', 'c') > > But, when I try this with a word that is all digits, this is not equivalent: > > $ perl6
> > < a b 137 > eqv ( 'a', 'b', '137' )
> False > > But, the other forms of word quoting are! >
> > qw/ a b 137 / eqv ( 'a', 'b', '137' )
> True
> > Q:w/ a b 137 / eqv ( 'a', 'b', '137' )
> True > > The angle-bracket word quoting uses > [IntStr](https://docs.perl6.org/type/IntStr): >
> > my @n = < a b 137 >
> [a b 137]
> > @n.perl
> ["a", "b", IntStr.new(137, "137")] > > Without the word quoting, the digits word comes out as [Str]: >
> > ( 'a', 'b', '137' ).perl
> ("a", "b", "137")
> > ( 'a', 'b', '137' )[*-1].perl
> "137"
> > ( 'a', 'b', '137' )[*-1].WHAT
> (Str)
> > my @n = ( 'a', 'b', '137' );
> [a b 137]
> > @n[*-1].WHAT
> (Str)
Thanks for the reqport, however, what you describe is not a bug, as the angle brackets have special feature to construct IntStr, NumStr, RatStr, and ComplexStr allomorphs as well as specify Rat and Complex literals. The documention was just misleading. I corrected it in: https://github.com/perl6/doc/commit/fa0b8f643356a3db1e5e59fda4f153f48f90ee90
Date: Sun, 27 Nov 2016 11:37:38 +0100
To: "brian d foy (via RT)" <perl6-bugs-followup [...] perl.org>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Subject: Re: [perl #130184] [BUG] All digit words in angle-bracket word quoting don't come out the same as the literally quoted word
Download (untitled) / with headers
text/plain 1.9k
I think this is not a bug but the result of angle brackets quoting, which creates allomorphs:. It is even documented: https://docs.perl6.org/language/glossary#index-entry-Allomorph Hope this helps. Show quoted text
> On 27 Nov 2016, at 00:47, brian d foy (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by "brian d foy" > # Please include the string: [perl #130184] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=130184 > > > > Adapted from the Stackoverflow answer at: > http://stackoverflow.com/a/40824226/2766176 > > I'm using moar (2016.10) on macosx (10.10.5) darwin (14.5.0) (These > variables are quite nice!) > > This came out of a problem I had with set membership. It turns out > that the way you make the set matters, and the way you make the > candidate member matters. In my case, there's a bug with angle-bracket > word quoting. > > I used the [angle-brackets form of the quote > words](https://docs.perl6.org/language/quoting#Word_quoting:_qw). The > quote words form is supposed to be equivalent to the quoting version > (that is, True under `eqv`). Here's the doc example: > > <a b c> eqv ('a', 'b', 'c') > > But, when I try this with a word that is all digits, this is not equivalent: > > $ perl6
>> < a b 137 > eqv ( 'a', 'b', '137' )
> False > > But, the other forms of word quoting are! >
>> qw/ a b 137 / eqv ( 'a', 'b', '137' )
> True
>> Q:w/ a b 137 / eqv ( 'a', 'b', '137' )
> True > > The angle-bracket word quoting uses > [IntStr](https://docs.perl6.org/type/IntStr): >
>> my @n = < a b 137 >
> [a b 137]
>> @n.perl
> ["a", "b", IntStr.new(137, "137")] > > Without the word quoting, the digits word comes out as [Str]: >
>> ( 'a', 'b', '137' ).perl
> ("a", "b", "137")
>> ( 'a', 'b', '137' )[*-1].perl
> "137"
>> ( 'a', 'b', '137' )[*-1].WHAT
> (Str)
>> my @n = ( 'a', 'b', '137' );
> [a b 137]
>> @n[*-1].WHAT
> (Str)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org