Re: I reproduced one of the errors!

2020-05-27 Thread ToddAndMargo via perl6-users

On 2020-05-27 14:32, Andy Bach wrote:

#!/usr/bin/env raku
my Str $x;
if $x.starts-with( "[" )  &&
$x.contains( "]" )
{ say "Passed"; } else { say "Failed"; }

K:\Windows\NtUtil>raku Contains.Test.pl6
Cannot resolve caller starts-with(Str:U: Str:D); none of these
signatures match

(Cool:D: Cool:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_
--> Bool)
(Cool:D: Cool:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
(Cool:D: Cool:D $needle, *%_ --> Bool)
(Str:D: Str:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_ -->
Bool)
(Str:D: Str:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
(Str:D: Str:D $needle, *%_ --> Bool)
in block  at Contains.Test.pl6 line 3

 > The function should just complain that the variable is not initialized.





Well, it is:
Cannot resolve caller starts-with(Str:U: Str:D);
...
in block  at Contains.Test.pl6 line 3

it says:
For line 3:
if $x.starts-with( "[" )
looking for a possible method 'starts-with' with a signature of 2 
params; an undefined string ('Str:U:') and a defined one ('Str:D:') 
failed - here's the list of the possible signatures raku currently has ..."


I'd not be surprise if you could write your own "starts-with(Str:U: 
Str:D); " method in raku and take care of this.  You could probably even 
have it "say"
You have an undefined String var in this call, not going to be able to 
do much useful matching against that.  Did you forget to initialize 
something?


Hi Andy,

The function should just complain that you need to feed it an
initialized value instead of sending you on a wild goose chase,

In that snippet, I deliberately did not initialize the variable
to trigger the weird behavior.

When I first encountered this error, I was testing a similar
uninitialized variable.  I thought it was populated because "say" said 
so.  "say" just had some shadow of another variable I had used to 
populate the uninitialized variable.


The value looked correct.  I spend a lot of time chasing
the wrong rabbit down the wrong rabbit hole.

-T


Re: I need a second pair of eyes

2020-05-27 Thread ToddAndMargo via perl6-users

On 2020-05-27 14:26, Will Coleda wrote:

Part of framing the question in the first place is reducing the
problem code to as small a subset as possible that still exhibits the
problem.


AND THEY ALWAYS WORK!     !

No reporting that back to the developers.


Often, in the course of doing this "golfing", you'll uncover the
problem yourself.


Very true.

Usually, I will go back and rewrite the thing as
human readable as possible, and low and behold, it
will start working and I have no clue what was wrong
with the original code.

I have when you have to go back and try and find a
single quote you accidentally copied and pasted from
a one liner test


Re: I reproduced one of the errors!

2020-05-27 Thread Andy Bach
#!/usr/bin/env raku
my Str $x;
if $x.starts-with( "[" )  &&
$x.contains( "]" )
{ say "Passed"; } else { say "Failed"; }

K:\Windows\NtUtil>raku Contains.Test.pl6
Cannot resolve caller starts-with(Str:U: Str:D); none of these
signatures match

 (Cool:D: Cool:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_
--> Bool)
 (Cool:D: Cool:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
 (Cool:D: Cool:D $needle, *%_ --> Bool)
 (Str:D: Str:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_ -->
Bool)
 (Str:D: Str:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
 (Str:D: Str:D $needle, *%_ --> Bool)
   in block  at Contains.Test.pl6 line 3

>  The function should just complain that the variable is not initialized.

Well, it is:
Cannot resolve caller starts-with(Str:U: Str:D);
...
in block  at Contains.Test.pl6 line 3

it says:
For line 3:
if $x.starts-with( "[" )
looking for a possible method 'starts-with' with a signature of 2 params; an 
undefined string ('Str:U:') and a defined one ('Str:D:') failed - here's the 
list of the possible signatures raku currently has ..."

I'd not be surprise if you could write your own "starts-with(Str:U: Str:D); " 
method in raku and take care of this.  You could probably even have it "say"
You have an undefined String var in this call, not going to be able to do much 
useful matching against that.  Did you forget to initialize something?


From: ToddAndMargo via perl6-users 
Sent: Wednesday, May 27, 2020 4:05 PM
To: perl6-users 
Subject: I reproduced one of the errors!

I managed to reproduce one of the errors I was getting.
I specifically did not initialize $x.  If I do, the
error goes away.  In my code, I did a "say $x" and it
said $x had something in it.  That is what threw me off


K:\Windows\NtUtil>raku -v
This is Rakudo version 2020.05.1 built on MoarVM version
2020.05 implementing Raku 6.d.



#!/usr/bin/env raku
my Str $x;
if $x.starts-with( "[" )  &&
$x.contains( "]" )
{ say "Passed"; } else { say "Failed"; }



K:\Windows\NtUtil>raku Contains.Test.pl6
Cannot resolve caller starts-with(Str:U: Str:D); none of these
signatures match

 (Cool:D: Cool:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_
--> Bool)
 (Cool:D: Cool:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
 (Cool:D: Cool:D $needle, *%_ --> Bool)
 (Str:D: Str:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_ -->
Bool)
 (Str:D: Str:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
 (Str:D: Str:D $needle, *%_ --> Bool)
   in block  at Contains.Test.pl6 line 3


The function should just complain that the variable is
not initialized.



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


Re: I need a second pair of eyes

2020-05-27 Thread Will Coleda
Part of framing the question in the first place is reducing the
problem code to as small a subset as possible that still exhibits the
problem.

Often, in the course of doing this "golfing", you'll uncover the
problem yourself.

On Wed, May 27, 2020 at 4:59 PM ToddAndMargo via perl6-users
 wrote:
>
> On 2020-05-27 13:38, Veesh Goldman wrote:
> > well, like I said before, if you just show ALL of your code, then we'd
> > be able to know what happened.
>
> I fixed the mistake I made, which also fixed the
> wrong output from "say", so all is working now
> and I doubt the issue would reproduce.
>
> The code itself is 420 lines long, plus modules.
> Would you like me to eMail you the code and
> all the modules?  I am no sure what you can do
> with it.


I reproduced one of the errors!

2020-05-27 Thread ToddAndMargo via perl6-users

I managed to reproduce one of the errors I was getting.
I specifically did not initialize $x.  If I do, the
error goes away.  In my code, I did a "say $x" and it
said $x had something in it.  That is what threw me off


K:\Windows\NtUtil>raku -v
This is Rakudo version 2020.05.1 built on MoarVM version
2020.05 implementing Raku 6.d.



#!/usr/bin/env raku
my Str $x;
if $x.starts-with( "[" )  &&
   $x.contains( "]" )
{ say "Passed"; } else { say "Failed"; }



K:\Windows\NtUtil>raku Contains.Test.pl6
Cannot resolve caller starts-with(Str:U: Str:D); none of these 
signatures match


(Cool:D: Cool:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_ 
--> Bool)

(Cool:D: Cool:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
(Cool:D: Cool:D $needle, *%_ --> Bool)
(Str:D: Str:D $needle, :i(:$ignorecase)!, :m(:$ignoremark), *%_ --> 
Bool)

(Str:D: Str:D $needle, :m(:$ignoremark)!, *%_ --> Bool)
(Str:D: Str:D $needle, *%_ --> Bool)
  in block  at Contains.Test.pl6 line 3


The function should just complain that the variable is
not initialized.



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


Re: I need a second pair of eyes

2020-05-27 Thread ToddAndMargo via perl6-users

On 2020-05-27 13:38, Veesh Goldman wrote:
well, like I said before, if you just show ALL of your code, then we'd 
be able to know what happened.


I fixed the mistake I made, which also fixed the
wrong output from "say", so all is working now
and I doubt the issue would reproduce.

The code itself is 420 lines long, plus modules.
Would you like me to eMail you the code and
all the modules?  I am no sure what you can do
with it.


Re: I need a second pair of eyes

2020-05-27 Thread Veesh Goldman
well, like I said before, if you just show ALL of your code, then we'd be
able to know what happened.

On Wed, May 27, 2020 at 8:55 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:

> On 2020-05-27 07:27, Brad Gilbert wrote:
> > The point was that 「say」 will print undefined values without complaining.
> >
> > Really debug statements should be more like:
> >
> > $*STDERR.put: 「%CommandLine = 」,
> %CommandLine;
> >
> > Or more succinctly:
> >
> > dd %CommandLine;
>
>
>
> Which does bring to the forefront, why a duplicate
> copy and paste of the same say line, one on
> top of the other, first delivered a value from
> another variable and the second one gave the correct
> value.
>
> I have converted to this say free sort of stuff;
>
> if  %Options< Debug >  {
>print "   ParentDir = <$ParentDir>\n";
>print "   NumBackups <$NumBackups>  Rotates %Options< Rotates >\n";
>print "   Sorted List   = [" ~ @Sorted_List ~ "]\n";
>print "   Ordered List  = [" ~ @Ordered_List ~ "]\n";
>print "   Rotated List  = [" ~ @Rotated_List ~ "]\n";
>print "   Reverse List  = [" ~ @Reverse_Pruned_List ~ "]\n";
>print "   Reverse_Pruned List = [" ~ @Reverse_Pruned_List ~ "]\n";
>print "   Number of backup directories is $NumBackups\n\n";
> }
>
>
> I like dd if I am interested in the structure of a variable
> but avoid it if only the value is of interest.
>
> And I could never in a million years be able to
> duplicate this issue for the developers
>


Re: I need a second pair of eyes

2020-05-27 Thread ToddAndMargo via perl6-users

On 2020-05-27 07:27, Brad Gilbert wrote:

The point was that 「say」 will print undefined values without complaining.

Really debug statements should be more like:

$*STDERR.put: 「%CommandLine = 」, %CommandLine;

Or more succinctly:

dd %CommandLine;




Which does bring to the forefront, why a duplicate
copy and paste of the same say line, one on
top of the other, first delivered a value from
another variable and the second one gave the correct
value.

I have converted to this say free sort of stuff;

   if  %Options< Debug >  {
  print "   ParentDir = <$ParentDir>\n";
  print "   NumBackups <$NumBackups>  Rotates %Options< Rotates >\n";
  print "   Sorted List   = [" ~ @Sorted_List ~ "]\n";
  print "   Ordered List  = [" ~ @Ordered_List ~ "]\n";
  print "   Rotated List  = [" ~ @Rotated_List ~ "]\n";
  print "   Reverse List  = [" ~ @Reverse_Pruned_List ~ "]\n";
  print "   Reverse_Pruned List = [" ~ @Reverse_Pruned_List ~ "]\n";
  print "   Number of backup directories is $NumBackups\n\n";
   }


I like dd if I am interested in the structure of a variable
but avoid it if only the value is of interest.

And I could never in a million years be able to
duplicate this issue for the developers


Re: I need a second pair of eyes

2020-05-27 Thread ToddAndMargo via perl6-users

On 2020-05-26 23:39, Peter Pentchev wrote:

On Tue, May 26, 2020 at 07:16:54PM -0700, ToddAndMargo via perl6-users wrote:

On 2020-05-25 23:42, ToddAndMargo via perl6-users wrote:

HI All,

I am missing something here:


154:   # figure out the label
155:   say %CommandLine;
156:   if "%CommandLine".starts-with( "[" )  &&
157:  "%CommandLine".contains( "]" ) {


BACKUP:\MyDocsBackup\backup1

[snip]



Follow up:

This turned ot the be the same issue as the other on:

say %CommandLine;
BACKUP:\MyDocsBackup\backup1

Was not the actual case.  %CommandLine
was actually blank.

I need to start using `print` instead of `say` to
proof things.

Thank you all for the help and tips!


This is... strange. Are you really, really sure that the "say" and
the "print" were really used on the same variable with the same value?
And the value is supposed to be a (possibly undefined) string?
And when the value is an undefined string (and nothing changes it after
"say" is called on it), "say" outputs something that looks like
a valid path?

This would be really, really strange. I'd say it would qualify as a bug,
unless there is something else happening there.

Are you really, really, really sure that there is nothing between
the call to "say" and the place where you use the variable that could
change the value? Are you also really, really, really sure that you have
not mistyped one of the names? If so, is there a way you could create
a minimal example, a short program that, when run on your system, always
behaves this way, and post it (attach the source file, don't retype it)
in full, so that people can try to run it on their systems and see if
"say" really does something strange?

G'luck,
Peter



Hi Peter,

What you saw is what I had.  Originally, I
thought I just need a second pair of eyes
and that I thought I saw what I saw, which
does happen to me more times than I would like
to admit.

What tipped me off was when I put a second
duplicate (copy and paste) say line right under
the first and the second one returned nothing.
This made me go back and look at how I populated
the variable in question and I found I had made
several mistakes and, indeed, the variable was
blank.

The value say gave, where it was suppose to give
a blank, was actually a value collected from the
run line that was used to populate the variable
in question.

The real bugger is that when things like this
happen, my first suspicion is that it is me doing
something wrong and 99% of the time that is the
case, so I had no idea this would be a Raku issue.
I wasted a lot of time chasing the wrong rabbit
down the wrong hole.

Oh ya, and good luck reproducing this for the
developers.

-T


Flycheck-raku module for MELPA

2020-05-27 Thread Xin Cheng
Hi

I am an emacs user, and I just installed the raku-mode for emacs. It is also 
advertised there is a flycheck-raku module on MELPA. But there is no such 
module. Instead, there is a flycheck-perl6 module. It seems the author would 
like people to switch from perl6-mode to raku-mode, from flycheck-perl6 to 
flycheck-raku. My guess is the author forget to upload the module to MELPA. 
Hopefully, the author is on the mailing list.

Regards

Xin




Re: I need a second pair of eyes

2020-05-27 Thread Brad Gilbert
The point was that 「say」 will print undefined values without complaining.

Really debug statements should be more like:

$*STDERR.put: 「%CommandLine = 」, %CommandLine;

Or more succinctly:

dd %CommandLine;

On Wed, May 27, 2020 at 1:39 AM Peter Pentchev  wrote:

> On Tue, May 26, 2020 at 07:16:54PM -0700, ToddAndMargo via perl6-users
> wrote:
> > On 2020-05-25 23:42, ToddAndMargo via perl6-users wrote:
> > > HI All,
> > >
> > > I am missing something here:
> > >
> > >
> > > 154:   # figure out the label
> > > 155:   say %CommandLine;
> > > 156:   if "%CommandLine".starts-with( "[" )  &&
> > > 157:  "%CommandLine".contains( "]" ) {
> > >
> > >
> > > BACKUP:\MyDocsBackup\backup1
> [snip]
> >
> >
> > Follow up:
> >
> > This turned ot the be the same issue as the other on:
> >
> > say %CommandLine;
> > BACKUP:\MyDocsBackup\backup1
> >
> > Was not the actual case.  %CommandLine
> > was actually blank.
> >
> > I need to start using `print` instead of `say` to
> > proof things.
> >
> > Thank you all for the help and tips!
>
> This is... strange. Are you really, really sure that the "say" and
> the "print" were really used on the same variable with the same value?
> And the value is supposed to be a (possibly undefined) string?
> And when the value is an undefined string (and nothing changes it after
> "say" is called on it), "say" outputs something that looks like
> a valid path?
>
> This would be really, really strange. I'd say it would qualify as a bug,
> unless there is something else happening there.
>
> Are you really, really, really sure that there is nothing between
> the call to "say" and the place where you use the variable that could
> change the value? Are you also really, really, really sure that you have
> not mistyped one of the names? If so, is there a way you could create
> a minimal example, a short program that, when run on your system, always
> behaves this way, and post it (attach the source file, don't retype it)
> in full, so that people can try to run it on their systems and see if
> "say" really does something strange?
>
> G'luck,
> Peter
>
> --
> Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
> PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
> Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
>


Re: I need a second pair of eyes

2020-05-27 Thread Peter Pentchev
On Tue, May 26, 2020 at 07:16:54PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-05-25 23:42, ToddAndMargo via perl6-users wrote:
> > HI All,
> > 
> > I am missing something here:
> > 
> > 
> > 154:   # figure out the label
> > 155:   say %CommandLine;
> > 156:   if "%CommandLine".starts-with( "[" )  &&
> > 157:  "%CommandLine".contains( "]" ) {
> > 
> > 
> > BACKUP:\MyDocsBackup\backup1
[snip]
> 
> 
> Follow up:
> 
> This turned ot the be the same issue as the other on:
> 
> say %CommandLine;
> BACKUP:\MyDocsBackup\backup1
> 
> Was not the actual case.  %CommandLine
> was actually blank.
> 
> I need to start using `print` instead of `say` to
> proof things.
> 
> Thank you all for the help and tips!

This is... strange. Are you really, really sure that the "say" and
the "print" were really used on the same variable with the same value?
And the value is supposed to be a (possibly undefined) string?
And when the value is an undefined string (and nothing changes it after
"say" is called on it), "say" outputs something that looks like
a valid path?

This would be really, really strange. I'd say it would qualify as a bug,
unless there is something else happening there.

Are you really, really, really sure that there is nothing between
the call to "say" and the place where you use the variable that could
change the value? Are you also really, really, really sure that you have
not mistyped one of the names? If so, is there a way you could create
a minimal example, a short program that, when run on your system, always
behaves this way, and post it (attach the source file, don't retype it)
in full, so that people can try to run it on their systems and see if
"say" really does something strange?

G'luck,
Peter

-- 
Peter Pentchev  r...@ringlet.net r...@debian.org p...@storpool.com
PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13


signature.asc
Description: PGP signature