Re: Quoting issue in Windows

2019-12-04 Thread ToddAndMargo via perl6-users

On 2019-12-04 08:47, yary wrote:

Requoting myself with emphasis

/> If you can post a *_file_* that does that, I'll eat my hat!/

show me an "exapmle.raku" file that the command "perl6 example.raku" 
won't interpolate variables in Windows but will in Unix in a buggy way, 
and I'll eat my hat. I'm not here to discuss command-line interpretation 
in DOS cmd.exe vs Bourne-shell /bin/sh vs Bourne-again-shell 
/usr/local/bin/bash etc.


-y


Hi Yary,

Oh it is consistent.  It was my misunderstanding
the '\' was not to be interpreted.  Your hat is
safe.   On the other hand, egg on my face, well,
lets say you get use to it.

:-)

-T

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: Quoting issue in Windows

2019-12-04 Thread yary
Requoting myself with emphasis

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

show me an "exapmle.raku" file that the command "perl6 example.raku" won't
interpolate variables in Windows but will in Unix in a buggy way, and I'll
eat my hat. I'm not here to discuss command-line interpretation in DOS
cmd.exe vs Bourne-shell /bin/sh vs Bourne-again-shell /usr/local/bin/bash
etc.

-y


On Wed, Dec 4, 2019 at 12:47 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2019-12-03 19:14, Paul Procacci wrote:
> > echo isn't a great example at all.  echo is both OS and SHELL specific.
> > Not only that, echo has argv to work with; each with it's own
> > terminating '\0'.
> > It absolutely can be quite literal, though that doesn't stop the
> > implementors from doing whatever they want.
> >
> > Here's a snippet from my own OS's `man echo`:
> >
> >   "Most shells provide a builtin echo command which tends to differ
> from
> >   this utility in the treatment of options and backslashes.  Consult
> the
> >   builtin(1) manual page."
> >
> >
> > Here's the cruft of it ..
> >
> > With a single quoted string . containing a single quote itself
> > ... in any given interpreted language . with no EOL or EOF in
> > sight 
> > How would you let the interpreter know your done?
> > The answer:  You can't without escaping the single quote.
> >
> > Some more examples I wrote up.
> > You'll note, they all use single quotes, yet they all interpret as they
> > absolutely should.
> >
> > Example Perl 5:
> > -
> > # perl -e "print '\''" ;
> > '
> > # perl -e "print '\\'" ;
> > \
> > # perl -e "print '\a'" ;
> > \a
> >
> >
> > Example PHP 7.3:
> > -
> > # php -r "print '\'';"
> > '
> > # php -r "print '\\';"
> > \
> > # php -r "print '\a';"
> > \a
> >
> > Example python3.6  **unique**:
> > ---
> > # python3.6 -c "print('\'')"
> > '
> > # python3.6 -c "print('\\')"
> > \
> > # python3.6 -c "print('\a')" | hexdump -oc | head -1
> > 000  005007
> >
>
> You make a good point.
>
> Bash language may be the exception then:
>
>
> $ cat echo.sh
> #!/usr/bin/bash
> echo '\'
>
> linuxutil]$ echo.sh
> \
>
>
> "echo" does not recognize interpretation unless you invoke
> it with -e
>
> $ echo -e '\\'
> \
>


Re: Quoting issue in Windows

2019-12-03 Thread ToddAndMargo via perl6-users

On 2019-12-03 19:14, Paul Procacci wrote:

echo isn't a great example at all.  echo is both OS and SHELL specific.
Not only that, echo has argv to work with; each with it's own 
terminating '\0'.
It absolutely can be quite literal, though that doesn't stop the 
implementors from doing whatever they want.


Here's a snippet from my own OS's `man echo`:

      "Most shells provide a builtin echo command which tends to differ from
      this utility in the treatment of options and backslashes.  Consult the
      builtin(1) manual page."


Here's the cruft of it ..

With a single quoted string . containing a single quote itself  
... in any given interpreted language . with no EOL or EOF in 
sight 

How would you let the interpreter know your done?
The answer:  You can't without escaping the single quote.

Some more examples I wrote up.
You'll note, they all use single quotes, yet they all interpret as they 
absolutely should.


Example Perl 5:
-
# perl -e "print '\''" ;
'
# perl -e "print '\\'" ;
\
# perl -e "print '\a'" ;
\a


Example PHP 7.3:
-
# php -r "print '\'';"
'
# php -r "print '\\';"
\
# php -r "print '\a';"
\a

Example python3.6  **unique**:
---
# python3.6 -c "print('\'')"
'
# python3.6 -c "print('\\')"
\
# python3.6 -c "print('\a')" | hexdump -oc | head -1
000  005007



You make a good point.

Bash language may be the exception then:


$ cat echo.sh
#!/usr/bin/bash
echo '\'

linuxutil]$ echo.sh
\


"echo" does not recognize interpretation unless you invoke
it with -e

$ echo -e '\\'
\


Re: Quoting issue in Windows

2019-12-03 Thread Paul Procacci
echo isn't a great example at all.  echo is both OS and SHELL specific.
Not only that, echo has argv to work with; each with it's own terminating
'\0'.
It absolutely can be quite literal, though that doesn't stop the
implementors from doing whatever they want.

Here's a snippet from my own OS's `man echo`:

 "Most shells provide a builtin echo command which tends to differ from
 this utility in the treatment of options and backslashes.  Consult the
 builtin(1) manual page."


Here's the cruft of it ..

With a single quoted string . containing a single quote itself  ...
in any given interpreted language . with no EOL or EOF in sight 
How would you let the interpreter know your done?
The answer:  You can't without escaping the single quote.

Some more examples I wrote up.
You'll note, they all use single quotes, yet they all interpret as they
absolutely should.

Example Perl 5:
-
# perl -e "print '\''" ;
'
# perl -e "print '\\'" ;
\
# perl -e "print '\a'" ;
\a


Example PHP 7.3:
-
# php -r "print '\'';"
'
# php -r "print '\\';"
\
# php -r "print '\a';"
\a

Example python3.6  **unique**:
---
# python3.6 -c "print('\'')"
'
# python3.6 -c "print('\\')"
\
# python3.6 -c "print('\a')" | hexdump -oc | head -1
000  005007


On Tue, Dec 3, 2019 at 9:04 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2019-12-03 17:31, Paul Procacci wrote:
> > When a string is specified in single quotes, perl6 (or any other
> > language that I'm aware of) will not evaluate or interpret an escape
> > character EXCEPT when the escape is follow'd by a single quote (') or
> > backslash(\).
> > These HAVE to be escaped and the interpreter HAS to account for it.
>
> Hi Paul,
>
> I am not finding that to be the case.  Well maybe not Perl 5.
>
> $ bash -c "echo '\'"
> \
>
> $ echo '\\\'
> \\\
>
> $ echo '\\'
> \\
>
> $ echo '\'
> \
>
>
>If it is on purpose and not a "feature" in Perl 6, then
> the documentation should state that single quotes will
> have interpretations inside of them in certain cases.
>
>
> Ahh Perl 5 is a pain in the butt backslash wise!
>
> $ perl -e "CORE::say '';"
> \
>
> And I am seeing in
> https://docs.perl6.org/language/quoting
>   Literal strings: Q
>   Q[A literal string]
>
> Is the way I have been using single quotes.
>
> So the rule is single quotes are literal, unless a backslash
> in included, then use Q
>
> Thank you for the help!
>
> -T
>


-- 
__

:(){ :|:& };:


Re: Quoting issue in Windows

2019-12-03 Thread ToddAndMargo via perl6-users

My keeper file on the subject;


perl6: literal quotes:

Reference(s):
https://docs.perl6.org/language/quoting


Everything inside single quotes ("''") is literal, EXCEPT if a
backslash (escape) is involved.  In that case use Q or a
double backslash (escape the escape)

$ p6 'say "Drive B:" ~ Q[\] ~ " is dismounted";'
Drive B:\ is dismounted

$ p6 'say "Drive B:" ~ Q[\abc\] ~ " is dismounted";'
Drive B:\abc\ is dismounted

$ p6 'say "Drive B:" ~ '\\' ~ " is dismounted";'
Drive B: is dismounted

$ p6 'say "Drive B:\\ is dismounted";'
Drive B:\ is dismounted


Re: Quoting issue in Windows

2019-12-03 Thread ToddAndMargo via perl6-users

On 2019-12-03 17:31, Paul Procacci wrote:
When a string is specified in single quotes, perl6 (or any other 
language that I'm aware of) will not evaluate or interpret an escape 
character EXCEPT when the escape is follow'd by a single quote (') or 
backslash(\).

These HAVE to be escaped and the interpreter HAS to account for it.


Hi Paul,

I am not finding that to be the case.  Well maybe not Perl 5.

$ bash -c "echo '\'"
\

$ echo '\\\'
\\\

$ echo '\\'
\\

$ echo '\'
\


  If it is on purpose and not a "feature" in Perl 6, then
the documentation should state that single quotes will
have interpretations inside of them in certain cases.


Ahh Perl 5 is a pain in the butt backslash wise!

$ perl -e "CORE::say '';"
\

And I am seeing in
https://docs.perl6.org/language/quoting
 Literal strings: Q
 Q[A literal string]

Is the way I have been using single quotes.

So the rule is single quotes are literal, unless a backslash
in included, then use Q

Thank you for the help!

-T


Re: Quoting issue in Windows

2019-12-03 Thread ToddAndMargo via perl6-users




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 '\'⏏
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.


Re: Quoting issue in Windows

2019-12-03 Thread yary
>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


On Tue, Dec 3, 2019 at 5:48 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> >> On Tue, Dec 3, 2019 at 3:55 AM ToddAndMargo via perl6-users
> >> mailto:perl6-us...@perl.org>> wrote:
> >>
> >> On 2019-12-02 07:02, The Sidhekin wrote:
> >>  >
> >>  > On Mon, Dec 2, 2019 at 11:07 AM ToddAndMargo via perl6-users
> >>  > mailto:perl6-us...@perl.org>
> >> >> wrote:
> >>  >
> >>  >
> >>  > What is the world is the Q doing in Q'\'?
> >>  >
> >>  >
> >>  > https://docs.perl6.org/language/quoting
> >>  >
> >>  >It would be clearer to write it as Q[\], I guess.
> >>  >
> >>  >
> >>  > Eirik
> >>
> >> Hi Eirik,
> >>
> >> Bug or feature?
> >>
> >> 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.  Single quotes is suppose to mean to
> >> take it literally and no escape interpretations.
> >>
> >> And it is only the Windows version.  In the
> >> Linux version, single quote do what they
> >> are suppose to do.
> >>
> >> I would report it to the bug reporter but I am not
> >> willing to deal with the guard dog.  Maybe if
> >> any developers are reading this, they would take it
> >> up.
> >>
> >> -T
> >>
>
> On 2019-12-03 00:05, Veesh Goldman wrote:
> > i'm on linux and single quotes behave like they're supposed to, and only
> > escape a single quote with a backslash. Are you sure the issue you're
> > having isn't with the command line or something?
> >
>
> Hi Veesh,
>
> This is from a pl6 file, not the command line.
>
> -T
>
>
> --
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~
>


Re: Quoting issue in Windows

2019-12-03 Thread ToddAndMargo via perl6-users
On Tue, Dec 3, 2019 at 3:55 AM ToddAndMargo via perl6-users 
mailto:perl6-us...@perl.org>> wrote:


On 2019-12-02 07:02, The Sidhekin wrote:
 >
 > On Mon, Dec 2, 2019 at 11:07 AM ToddAndMargo via perl6-users
 > mailto:perl6-us...@perl.org>
>> wrote:
 >
 >
 > What is the world is the Q doing in Q'\'?
 >
 >
 > https://docs.perl6.org/language/quoting
 >
 >It would be clearer to write it as Q[\], I guess.
 >
 >
 > Eirik

Hi Eirik,

Bug or feature?

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.  Single quotes is suppose to mean to
take it literally and no escape interpretations.

And it is only the Windows version.  In the
Linux version, single quote do what they
are suppose to do.

I would report it to the bug reporter but I am not
willing to deal with the guard dog.  Maybe if
any developers are reading this, they would take it
up.

-T



On 2019-12-03 00:05, Veesh Goldman wrote:
i'm on linux and single quotes behave like they're supposed to, and only 
escape a single quote with a backslash. Are you sure the issue you're 
having isn't with the command line or something?




Hi Veesh,

This is from a pl6 file, not the command line.

-T


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: Quoting issue in Windows

2019-12-03 Thread Veesh Goldman
i'm on linux and single quotes behave like they're supposed to, and only
escape a single quote with a backslash. Are you sure the issue you're
having isn't with the command line or something?

On Tue, Dec 3, 2019 at 3:55 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2019-12-02 07:02, The Sidhekin wrote:
> >
> > On Mon, Dec 2, 2019 at 11:07 AM ToddAndMargo via perl6-users
> > mailto:perl6-us...@perl.org>> wrote:
> >
> >
> > What is the world is the Q doing in Q'\'?
> >
> >
> > https://docs.perl6.org/language/quoting
> >
> >It would be clearer to write it as Q[\], I guess.
> >
> >
> > Eirik
>
> Hi Eirik,
>
> Bug or feature?
>
> 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.  Single quotes is suppose to mean to
> take it literally and no escape interpretations.
>
> And it is only the Windows version.  In the
> Linux version, single quote do what they
> are suppose to do.
>
> I would report it to the bug reporter but I am not
> willing to deal with the guard dog.  Maybe if
> any developers are reading this, they would take it
> up.
>
> -T
>


Re: Quoting issue in Windows

2019-12-02 Thread ToddAndMargo via perl6-users

On 2019-12-02 07:02, The Sidhekin wrote:


On Mon, Dec 2, 2019 at 11:07 AM ToddAndMargo via perl6-users 
mailto:perl6-us...@perl.org>> wrote:



What is the world is the Q doing in Q'\'?


https://docs.perl6.org/language/quoting

   It would be clearer to write it as Q[\], I guess.


Eirik


Hi Eirik,

Bug or feature?

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.  Single quotes is suppose to mean to
take it literally and no escape interpretations.

And it is only the Windows version.  In the
Linux version, single quote do what they
are suppose to do.

I would report it to the bug reporter but I am not
willing to deal with the guard dog.  Maybe if
any developers are reading this, they would take it
up.

-T


Re: Quoting issue in Windows

2019-12-02 Thread ToddAndMargo via perl6-users

On 2019-12-02 07:02, The Sidhekin wrote:


On Mon, Dec 2, 2019 at 11:07 AM ToddAndMargo via perl6-users 
mailto:perl6-us...@perl.org>> wrote:



What is the world is the Q doing in Q'\'?


https://docs.perl6.org/language/quoting

   It would be clearer to write it as Q[\], I guess.


Eirik



Ah Ha!  A workaround to an obvious bug in the
Windows version.

Thank you!


Re: Quoting issue in Windows

2019-12-02 Thread The Sidhekin
On Mon, Dec 2, 2019 at 11:07 AM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

>
> What is the world is the Q doing in Q'\'?
>

  https://docs.perl6.org/language/quoting

  It would be clearer to write it as Q[\], I guess.


Eirik


Re: Quoting issue in Windows

2019-12-02 Thread ToddAndMargo via perl6-users

On 2019-12-01 19:28, yary wrote:
None of the examples in the earlier emails were on the command line. 
Please only use the examples in my prior message in this thread inside a 
program file. Using these on the command-line is outside the scope of 
what I want to deal with here.


Windows quoting on the command line is enough of a headache that I use 
this rule- double quotes only at the first and last character of an 
argument. There's more to it... I don't want to spend lots of time on 
the arcana.


Hi Yary,

I have about had it with Windows one liners.


my Str $Drive = "B";
print( "Drive $Drive:\\ dismounted\n\n" ); # I prefer, no need for ~
print( "Drive $Drive:" ~ Q'\' ~ " dismounted\n\n" );



K:\Windows\NtUtil>perl6 yary1.pl6
Drive B:\ dismounted

Drive B:\ dismounted

Joy.


What is the world is the Q doing in Q'\'?

Thank you for the help!

-T


Re: Quoting issue in Windows

2019-12-01 Thread yary
None of the examples in the earlier emails were on the command line. Please
only use the examples in my prior message in this thread inside a program
file. Using these on the command-line is outside the scope of what I want
to deal with here.

Windows quoting on the command line is enough of a headache that I use this
rule- double quotes only at the first and last character of an argument.
There's more to it... I don't want to spend lots of time on the arcana.


Re: Quoting issue in Windows

2019-12-01 Thread ToddAndMargo via perl6-users

On 2019-12-01 12:12, yary wrote:

Hi Todd,

Going back to the original post-
     print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );

Inside a single quote, the \' combination is how you make a single quote, eg
     $ perl6
     > 'Saying \'hello\' to you'
     Saying 'hello' to you

ways around it-

     print( "Drive $Drive:\\dismounted\n\n" ); # I prefer, no need for ~

or

     print( "Drive $Drive:" ~ Q'\' ~ " dismounted\n\n" );

-y


Hi Yary,

The single and double quote thing in Windows drive me a
bit insane.

I do the `Str ~ weird char` thing as it is easier for me
to under stand that I am combining string unfriendly
parts.  And I don't have to remember who escapes what.
I may have to give up the practice with Windows


I do not understand the  Q'\'
Windows
K:\Windows\NtUtil>perl6 -e "my $Drive = \"B\";print( \"Drive $Drive:\" ~ 
Q'\' ~ \" dismounted\n\n\" );"


Drive B:\ dismounted



Linux
$ perl6 -e 'my $Drive = "B";print( "Drive $Drive:" ~ Q"\'" ~ " 
dismounted\n\n\" );'

bash: syntax error near unexpected token `)'


Linux
$ perl6 -e 'my $Drive = "B"; print( "Drive $Drive\:\\ dismounted\n\n" );'
Drive B:\ dismounted


Windows
K:\Windows\NtUtil>perl6 -e 'my $Drive = "B"; print( "Drive $Drive\:\\ 
dismounted

\n\n" );'
===SORRY!=== Error while compiling -e
Unable to parse expression in single quotes; couldn't find final "'" 
(correspond

ing starter was at line 1)
at -e:1
--> 'my
expecting any of:
single quotes
statement list
term


Windows again escaping double quotes
K:\Windows\NtUtil>perl6 -e "my $Drive = \"B\"; print( \"Drive $Drive\:\\ 
dismounted\n\n\" );"

Drive B:\ dismounted


Thank you for the help!

-T



--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: Quoting issue in Windows

2019-12-01 Thread yary
Hi Todd,

Going back to the original post-
print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );

Inside a single quote, the \' combination is how you make a single quote, eg
$ perl6
> 'Saying \'hello\' to you'
Saying 'hello' to you

ways around it-

print( "Drive $Drive:\\dismounted\n\n" ); # I prefer, no need for ~

or

print( "Drive $Drive:" ~ Q'\' ~ " dismounted\n\n" );

-y


On Sat, Nov 30, 2019 at 8:56 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2019-11-30 06:28, Timo Paulssen wrote:
> >
> > On 30/11/2019 09:05, ToddAndMargo via perl6-users wrote:
> >> One of the weirdest was
> >>
> >> for @Result.kv -> $I, $Line {
> >> if $I % 2 = 0
> >>
> >> being told I could not change an immutable object.
> >
> >
> > Here you're trying to assign 0 to the result of $I % 2, if that's
> > actually exactly the code. You want to compare here, not assign, i.e.
> > use == instead of =
> >
> > HTH
> >- Timo
> >
>
> Hi Timo,
>
> Indeed!
>
> And the 64000 dollar question is why did the compiler not
> toss it out?
>
> -T
>


Re: Quoting issue in Windows

2019-11-30 Thread ToddAndMargo via perl6-users

On 2019-11-30 06:28, Timo Paulssen wrote:


On 30/11/2019 09:05, ToddAndMargo via perl6-users wrote:

One of the weirdest was

for @Result.kv -> $I, $Line {
    if $I % 2 = 0

being told I could not change an immutable object.



Here you're trying to assign 0 to the result of $I % 2, if that's
actually exactly the code. You want to compare here, not assign, i.e.
use == instead of =

HTH
   - Timo



Hi Timo,

Indeed!

And the 64000 dollar question is why did the compiler not
toss it out?

-T


Re: Quoting issue in Windows

2019-11-30 Thread ToddAndMargo via perl6-users

On 2019-11-30 08:37, Veesh Goldman wrote:
Also, you may want to use the divisibility operator %% instead of 
modulo. I think

     if $i %% 2
Is clearer to read.


Hi Veesh,

Indeed!  Thank you.  Modulus (%) is burned into my head.
Now all I have to do is remember divisible (%%).

:-)

Thank you.

-T

My notes:


Perl6: divisible: %%

Divisible by 2

$ perl6 -e "if 3 %% 2 {say 'even'}else{say 'odd'; }"
odd


With modulus: %

$ perl6 -e "if 3 % 2 == 1  {say 'even'}else{say 'odd'; }"
even

$ perl6 -e "if 3 % 2 == 1  {say 'odd'}else{say 'een'; }"
odd


Re: Quoting issue in Windows

2019-11-30 Thread ToddAndMargo via perl6-users

On 2019-11-30 00:57, William Michels via perl6-users wrote:

Hi Todd, You should definitely write up some code and post it here on
the mailing list, so we all can test it. I found an error "Cannot
modify an immutable Match" a while back (Oct 2019), and it turned out
to be a bug:

https://www.nntp.perl.org/group/perl.perl6.users/2019/10/msg7067.html

Best Regards, Bill.


Hi Bill,

A few days ago I broke my rule ago I reporting to

https://github.com/rakudo/rakudo/issues/

It is a waste of my time as it is too hard to get
part the guard dog.   I am going to go back to
not reporting them.  I report a lot to Fedora.  They
are very professional about it.  I report to Libre
Office a lot too.  They have an impressive guard dogs
too, but if you keep arguing with him long enough,
a developer will eventually see it and overrule the
guard dog.

But here is a different story.


Windows 7, sp1, x64
rakudo-star-2019.03-x86_64 (JIT).msi

Okay, first a test.

K:\Windows\NtUtil>perl6 -e "say 3 % 2;"
1

Yup modulus works



#`{

Print out the UUID's of partitions that have a label of BACKUP

C:\NtUtil>perl6 UUID.pl6
partitons with the label of BACKUP:
\\?\Volume{9b358c63-e345-401d-828c-c5f99066269b}\
\\?\Volume{9a60e05f-39b1-41be-8aad-acbe62f78ee4}\
\\?\Volume{9fec274f-2a58-4a44-804d-f7a5777aaa57}\
\\?\Volume{30347b97-d2aa-4b67-a163-dd7e3f133cdf}\
\\?\Volume{981c447a-b600-4fbb-ae44-c743a393e3c5}\
}


my @Result;
my Str $RtnStr;
my Str $DeviceID;
my Str $Label;
my Str $Name;

@Result = qx ( wmic.exe volume get deviceid,label,name ).lines;

say "partitions with the label of BACKUP:";
for @Result.kv -> $I, $Line {
   # my $J = $I % 2;
   # if $J == 1  ||  $Line.chars == 0  { next; };
   if $I % 2 == 1 { next; }

   $DeviceID = $Line.substr(0..48);
   # w7
   # $Label= $Line.substr(51..66);
   # $Name = $Line.substr(69..71);

   # w10
   $Label= $Line.substr(51..58).trim;
   $Name = $Line.substr(61..63);

   if $Label eq "BACKUP"  {
  say $DeviceID;
  if $Name.contains( ":" )  {
  say "WARNING: $DeviceID is mounted as $Name.  Dismounting";
  $RtnStr = qqx ( MountVol.exe $Name /D );
  }
   }

   # say "Device ID <" ~ $DeviceID ~ ">";
   # say "Label <" ~ $Label~ ">";
   # say "name  <" ~ $Name ~ ">";
   # say "";
}
perl6 -c UUID.pl6
Syntax OK

Hmmm..


K:\Windows\NtUtil>perl6 UUID.pl6
partitions with the label of BACKUP:
Cannot modify an immutable Int (0)
  in block  at UUID.pl6 line 27

24: for @Result.kv -> $I, $Line {
25:# my $J = $I % 2;
26:# if $J == 1  ||  $Line.chars == 0  { next; };
27:if $I % 2 = 0 { next; }
27:

H

Did you catch my error on line 27?   It should have been
"==" not "=".

So maybe the guard dog would have been right on this one.

But you would have though that "$I % 2 = 0" would have
thrown a compiler error.

K:\Windows\NtUtil>perl6 -e "if 3 % 2 = 1 {say \"odd\"; }"
Cannot modify an immutable Int (1)
  in block  at -e line 1


-T


Re: Quoting issue in Windows

2019-11-30 Thread Veesh Goldman
Also, you may want to use the divisibility operator %% instead of modulo. I
think
if $i %% 2
Is clearer to read.

On Sat, Nov 30, 2019, 16:28 Timo Paulssen  wrote:

>
> On 30/11/2019 09:05, ToddAndMargo via perl6-users wrote:
> > One of the weirdest was
> >
> > for @Result.kv -> $I, $Line {
> >if $I % 2 = 0
> >
> > being told I could not change an immutable object.
>
>
> Here you're trying to assign 0 to the result of $I % 2, if that's
> actually exactly the code. You want to compare here, not assign, i.e.
> use == instead of =
>
> HTH
>   - Timo
>


Re: Quoting issue in Windows

2019-11-30 Thread Timo Paulssen


On 30/11/2019 09:05, ToddAndMargo via perl6-users wrote:
> One of the weirdest was
>
> for @Result.kv -> $I, $Line {
>    if $I % 2 = 0
>
> being told I could not change an immutable object.


Here you're trying to assign 0 to the result of $I % 2, if that's
actually exactly the code. You want to compare here, not assign, i.e.
use == instead of =

HTH
  - Timo


Re: Quoting issue in Windows

2019-11-30 Thread William Michels via perl6-users
On Sat, Nov 30, 2019 at 12:05 AM ToddAndMargo via perl6-users
 wrote:
>
> On 2019-11-29 23:49, William Michels via perl6-users wrote:
> > On Fri, Nov 29, 2019 at 8:33 PM ToddAndMargo via perl6-users
> >  wrote:
> >>
> >> Hi All,
> >>
> >> Windows 7, sp1, x64
> >> rakudo-star-2019.03-x86_64 (JIT).msi
> >>
> >> Why does this type of line keep giving me heartburn?
> >>
> >> print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );
> >>
> >> K:\Windows\NtUtil>perl6 -c WinMount.pm6
> >> ===SORRY!=== Error while compiling K:\Windows\NtUtil/WinMount.pm6
> >> Confused (runaway multi-line '' quote starting at line 84 maybe?)
> >>
> >> at K:\Windows\NtUtil/WinMount.pm6:92
> >> -->   print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" 
> >> );
> >>   expecting any of:
> >>   postfix
> >>
> >>
> >> I have to take out the '\' and replace it with "\\" to
> >> get it to stop complaining.
> >>
> >> -T
> >
> > Hi Todd, sounds like a "naked" (single) backslash is being interpreted
> > as a multi-line separator, the same separator that allows one to do
> > multi-line input on the terminal command line (below):
> >
> > mbook:~ homedir$ perl6 -e 'my $Drive = "C"; \
> >> print( "Drive $Drive" \
> >>   ~ ":" \
> >>   ~ "\\" \
> >>   ~ " dismounted\n\n" );'
> > Drive C:\ dismounted
> >
> > mbook:~ homedir$
> >
> > HTH, Bill.
> >
>
>
> Hi Bill,
>
> That would make sense.
>
> I am finding all kinds of little annoyances with the
> Windows version that don't exist in the Linux version.
> But as long as I can work around them, Perl 6 is so, so
> much better than it is not a issue.
>
> Thank you for the help!
>
> -T
>
> One of the weirdest was
>
> for @Result.kv -> $I, $Line {
> if $I % 2 = 0
>
> being told I could not change an immutable object.

Hi Todd, You should definitely write up some code and post it here on
the mailing list, so we all can test it. I found an error "Cannot
modify an immutable Match" a while back (Oct 2019), and it turned out
to be a bug:

https://www.nntp.perl.org/group/perl.perl6.users/2019/10/msg7067.html

Best Regards, Bill.


Re: Quoting issue in Windows

2019-11-30 Thread ToddAndMargo via perl6-users

On 2019-11-29 23:49, William Michels via perl6-users wrote:

On Fri, Nov 29, 2019 at 8:33 PM ToddAndMargo via perl6-users
 wrote:


Hi All,

Windows 7, sp1, x64
rakudo-star-2019.03-x86_64 (JIT).msi

Why does this type of line keep giving me heartburn?

print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );

K:\Windows\NtUtil>perl6 -c WinMount.pm6
===SORRY!=== Error while compiling K:\Windows\NtUtil/WinMount.pm6
Confused (runaway multi-line '' quote starting at line 84 maybe?)

at K:\Windows\NtUtil/WinMount.pm6:92
-->   print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );
  expecting any of:
  postfix


I have to take out the '\' and replace it with "\\" to
get it to stop complaining.

-T


Hi Todd, sounds like a "naked" (single) backslash is being interpreted
as a multi-line separator, the same separator that allows one to do
multi-line input on the terminal command line (below):

mbook:~ homedir$ perl6 -e 'my $Drive = "C"; \

print( "Drive $Drive" \
  ~ ":" \
  ~ "\\" \
  ~ " dismounted\n\n" );'

Drive C:\ dismounted

mbook:~ homedir$

HTH, Bill.




Hi Bill,

That would make sense.

I am finding all kinds of little annoyances with the
Windows version that don't exist in the Linux version.
But as long as I can work around them, Perl 6 is so, so
much better than it is not a issue.

Thank you for the help!

-T

One of the weirdest was

for @Result.kv -> $I, $Line {
   if $I % 2 = 0

being told I could not change an immutable object.


Re: Quoting issue in Windows

2019-11-29 Thread William Michels via perl6-users
On Fri, Nov 29, 2019 at 8:33 PM ToddAndMargo via perl6-users
 wrote:
>
> Hi All,
>
> Windows 7, sp1, x64
> rakudo-star-2019.03-x86_64 (JIT).msi
>
> Why does this type of line keep giving me heartburn?
>
> print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );
>
> K:\Windows\NtUtil>perl6 -c WinMount.pm6
> ===SORRY!=== Error while compiling K:\Windows\NtUtil/WinMount.pm6
> Confused (runaway multi-line '' quote starting at line 84 maybe?)
>
> at K:\Windows\NtUtil/WinMount.pm6:92
> -->   print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );
>  expecting any of:
>  postfix
>
>
> I have to take out the '\' and replace it with "\\" to
> get it to stop complaining.
>
> -T

Hi Todd, sounds like a "naked" (single) backslash is being interpreted
as a multi-line separator, the same separator that allows one to do
multi-line input on the terminal command line (below):

mbook:~ homedir$ perl6 -e 'my $Drive = "C"; \
> print( "Drive $Drive" \
>  ~ ":" \
>  ~ "\\" \
>  ~ " dismounted\n\n" );'
Drive C:\ dismounted

mbook:~ homedir$

HTH, Bill.