On Sun, 13 Dec 2015 06:03:35 -0800, elizabeth wrote: > Completely right! > > 5b6cbc7d54ce5ad252cf74 fixes Pair.perl properly. > > > Liz > > > On 13 Dec 2015, at 11:16, Timo Paulssen <t...@wakelift.de> wrote: > > > > I think you might have misread the bug report. > > > > This bug is about the .perl method on Pair not being careful enough > > if > > the .perl of its .key looks like /<ident>/. > > > > I am reluctant to add a full ~~ /<ident>/ to the .perl, as matching > > carries quite a big overhead at the moment and that'd make printing a > > list of pairs extra slow. Perhaps we could use "findnotcclass" to > > look > > for non-alpha in the .perl and just throw parenthesis around it if > > anything looks vaguely suspicious. > > > > On 12/13/2015 11:13 AM, Elizabeth Mattijsen wrote: > >>> On 13 Dec 2015, at 05:18, Zefram (via RT) <perl6-bugs- > >>> follo...@perl.org> wrote: > >>> > >>> # New Ticket Created by Zefram > >>> # Please include the string: [perl #126890] > >>> # in the subject line of all future correspondence about this > >>> issue. > >>> # <URL: https://rt.perl.org/Ticket/Display.html?id=126890 > > >>> > >>> > >>> $ perl6 -e '((Nil)=>1).key.WHAT.say; > >>> ((Nil)=>1).perl.EVAL.key.WHAT.say' > >>> Nil > >>> (Str) > >>> > >>> The problem is that the .perl of that pair is "Nil => 1", which > >>> parses > >>> as a string key rather than the Nil object. Parens or some other > >>> circumlocution is required in order to preserve the meaning of > >>> "Nil" > >>> in this context. > >> I think this is ENOTABUG. > >> > >> Perl 6 has the same auto-quoting rules for the left side of a fat > >> comma as Perl 5. > >> > >> $ 6 'dd (Any => 42).key' > >> Str $var = “Any" > >> > >> $ 6 'dd ((Any) => 42).key' > >> Any $var = Any > >> > >> So, yes, you need to do something extra to keep the typedness of the > >> left hand side. Just as you would need to do in Perl 5. > >> > >> > >> Another way of creating a Pair, is Pair.new: > >> > >> $ 6 'dd Pair.new(Any,42).key' > >> Any $var = Any > >> > >> > >> YMMV > >> > >> > >> > >> Liz > >
Test added in roast commit 56ec03599, so resolving this ticket.