On 2019-12-03 08:04, yary wrote:
 >Seems to me there is a bug here that
 >
 >     rakudo-star-2019.03-x86_64 (JIT).msi
 >
 >is trying to interpret things inside single quotes.

If you can post a file that does that, I'll eat my hat!

here's a little recap of the basic quoting, which does exactly the same in recent perl6 and decade-plus-old perl 5.6-ish

bash-3.2$ /cat perl-quotes/

my $name = 'mud';
print 'single quote \\ \" \' \[\] \n single name is $name', "\n";
print "double quote \\ \" \' \[\] \n double name is $name", "\n";

print q[q bracket \\ \" \' \[\] \n q bracket name is $name],  "\n";
print qq[qq bracket \\ \" \' \[\] \n qq bracket name is $name],"\n";

# Can use quote instead of brackets- but most folks don't
print q"q double \\ \" \' \[\] \n q double name is $name",   "\n";

bash-3.2$ /perl perl-quotes ; # Classic perl/
single quote \ \" ' \[\] \n single name is $name
double quote \ " ' []
  double name is mud
q bracket \ \" \' [] \n q bracket name is $name
qq bracket \ " ' []
  qq bracket name is mud
q double \ " \' \[\] \n q double name is $name
bash-3.2$ /perl6 perl-quotes ; # Raku/
single quote \ \" ' \[\] \n single name is $name
double quote \ " ' []
  double name is mud
q bracket \ \" \' [] \n q bracket name is $name
qq bracket \ " ' []
  qq bracket name is mud
q double \ " \' \[\] \n q double name is $name

Inside 'single quotes' or q[q string] backslash only has special meaning , when escaping the string delimiter - note that ' \' ' evaluates to a single quote without the backslash, but q[ \' ] keeps the backslash.

Variables only interpolated in the "double quote" qq[qq string] forms.

The big Q[string] or Q'string' that Raku has is an extension of those q, qq forms. It doesn't have any escapes at all. I'm not posting an example because I have to get back to work, feel free to experiment!


-y




Hi Yary,

$ perl6 -e "say '\'";
===SORRY!=== Error while compiling -e
Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1)
at -e:1
------> say '\'⏏<EOL>
    expecting any of:
        argument list
        single quotes
        term


https://docs.raku.org/language/quoting#index-entry-quote_q-quote_'_'-Escaping:_q

     "The backslash itself can be escaped, too, as in the
     third example above. *The usual form is '…'* or q
     followed by a delimiter, but it's also available
     as an adverb on Q, as in the fifth and last example above.

$ p6 "say '\'"; is not following the *"The usual form is '…'"* in the manual. EVERYTHING inside single quotes is suppose to be literal. NOTHING is to be interpreted.

Would you like salt and pepper with your hat?

And if I am wrong, how does hat taste?  Typically
with me, it is egg all over my face.

Thank you for the help!

-T

What???  Me read the manual?  For beginners, the manual
really stinks, but I do consult it a lot.  Sometimes
they will slip an example in that gets past the
IEEE-eese.

Reply via email to