Re: more match humility

2017-03-14 Thread ToddAndMargo

On 03/14/2017 12:02 AM, Brent Laabs wrote:

I'm not sure what you mean by lexiconical.  I can't find any references
to it in the official perl documentation (which would technically be
lexicanonical, right?).


The joke was that everything you did not understand was lexiconical.


But if you're talking about lexical scope, then yeah, Perl 6 enforces
that even more than Perl 5 does by default.


Actually, .gist fill in the gap where it is not.  Here is
an example of where regex did not force a string

&?ROUTINE ~~ m/' '(.*?)' '\(/;

And I personally don't care as long as I understand the rules.

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


Re: more match humility

2017-03-14 Thread Brent Laabs
I'm not sure what you mean by lexiconical.  I can't find any references to
it in the official perl documentation (which would technically be
lexicanonical, right?).

But if you're talking about lexical scope, then yeah, Perl 6 enforces that
even more than Perl 5 does by default.

On Mon, Mar 13, 2017 at 10:50 PM, ToddAndMargo 
wrote:

> On 03/13/2017 10:20 PM, Brandon Allbery wrote:
>
>> Just to be a little more clear about what is happening here:
>>
>> Perl 5 tended to treat things as strings if you use them as strings, or
>> as numbers if you use them as numbers. Perl 6 is more strict about that,
>> but makes an exception for specifically numbers and strings; if you have
>> noticed the class "Cool", that's a class whose subclasses are string and
>> number classes, and which tries to make one into the other if needed.
>>
>> Subs aren't Cool. [ :) ] They are objects of type Sub, which is *not* a
>> String (nor has a Stringy role, nor is a subclass of Cool). Perl 6 wants
>> you to explicitly make a string in this case; and as there are multiple
>> strings one could want (the name? a summary of the definition like .gist
>> makes? the full definition like .perl is intended to make but IIRC
>> doesn't yet? something else?) you need to specify exactly *what* string
>> to get from a Sub object.
>>
>
> Hi Brandon
> Makes sense.  Thank you for the tutorial!
>
> So Perl 6 is less "Lexiconical" that Perl 5?
>
> :-)
>
> I know, I am going to the bad hell.
>
> When I was learning Perl 5, the  term "Lexiconical" drove
> me nuts.  "JUST SAY WHAT YOU MEAN"   "Lexiconical"
> meant noting to me for the longest time.  And every time
> I looked it up, I understood it for about 20 seconds,
> then lost it again.
>
> Perl 6 is so much better done than Perl 5. I am a Top Down
> guy (you will notice a lot fo subs in my postings) and
> Perl 6's sub's are a match made in heaven.  I adore
> Perl 6's subs.
>
> I came from Modula 2.  "Lexiconical" is a dirty word
> over there.  Everything is literal.
>
> -T
>


Re: more match humility

2017-03-13 Thread ToddAndMargo

On 03/13/2017 10:20 PM, Brandon Allbery wrote:

Just to be a little more clear about what is happening here:

Perl 5 tended to treat things as strings if you use them as strings, or
as numbers if you use them as numbers. Perl 6 is more strict about that,
but makes an exception for specifically numbers and strings; if you have
noticed the class "Cool", that's a class whose subclasses are string and
number classes, and which tries to make one into the other if needed.

Subs aren't Cool. [ :) ] They are objects of type Sub, which is *not* a
String (nor has a Stringy role, nor is a subclass of Cool). Perl 6 wants
you to explicitly make a string in this case; and as there are multiple
strings one could want (the name? a summary of the definition like .gist
makes? the full definition like .perl is intended to make but IIRC
doesn't yet? something else?) you need to specify exactly *what* string
to get from a Sub object.


Hi Brandon
Makes sense.  Thank you for the tutorial!

So Perl 6 is less "Lexiconical" that Perl 5?

:-)

I know, I am going to the bad hell.

When I was learning Perl 5, the  term "Lexiconical" drove
me nuts.  "JUST SAY WHAT YOU MEAN"   "Lexiconical"
meant noting to me for the longest time.  And every time
I looked it up, I understood it for about 20 seconds,
then lost it again.

Perl 6 is so much better done than Perl 5. I am a Top Down
guy (you will notice a lot fo subs in my postings) and
Perl 6's sub's are a match made in heaven.  I adore
Perl 6's subs.

I came from Modula 2.  "Lexiconical" is a dirty word
over there.  Everything is literal.

-T


Re: more match humility

2017-03-13 Thread Brandon Allbery
Just to be a little more clear about what is happening here:

Perl 5 tended to treat things as strings if you use them as strings, or as
numbers if you use them as numbers. Perl 6 is more strict about that, but
makes an exception for specifically numbers and strings; if you have
noticed the class "Cool", that's a class whose subclasses are string and
number classes, and which tries to make one into the other if needed.

Subs aren't Cool. [ :) ] They are objects of type Sub, which is *not* a
String (nor has a Stringy role, nor is a subclass of Cool). Perl 6 wants
you to explicitly make a string in this case; and as there are multiple
strings one could want (the name? a summary of the definition like .gist
makes? the full definition like .perl is intended to make but IIRC doesn't
yet? something else?) you need to specify exactly *what* string to get from
a Sub object.

On Tue, Mar 14, 2017 at 1:00 AM, ToddAndMargo  wrote:

> On 03/13/2017 09:16 PM, ToddAndMargo wrote:
>
>> What am I doing wrong now !?!?!  :'(  :'(  :'(
>>
>> 
>> #!/usr/bin/perl6
>>
>> sub Test () {
>>
>>my $f = $?FILE; say "\$\?FILE=<$f>";
>>my $g = $?FILE.IO.basename;  say "\$\?FILE.IO.basename=<$g>";
>>( my $IAm = $?FILE ) ~~ s|.*"/"||; say "Regex \$IAm=<$IAm>";
>>
>>
>># sub Test () { #`(Sub|58588296) ... }
>>my $h = &?ROUTINE;
>>say "\&\?ROUTINE=<$h>\n";
>>$h ~~ m/' '(.*?)' '\(/;
>>say "This sub\'s name is <$0>";
>> }
>>
>>
>> Test();
>> 
>>
>>
>> $ WhoTest.pl6
>> $?FILE=
>> $?FILE.IO.basename=
>> Regex $IAm=
>> Sub object coerced to string (please use .gist or .perl to do that)
>>   in sub Test at ./WhoTest.pl6 line 12
>> &?ROUTINE=
>>
>> No such method 'match' for invocant of type 'Sub'
>>   in sub Test at ./WhoTest.pl6 line 13
>>   in block  at ./WhoTest.pl6 line 18
>>
>>
>> &?ROUTINE
>>
>>
>>
>>
>
> Figured it out with the help of the chat line.  I
> need to add .gist onto &?ROUTINE so that regex sees
> a string
>
>
>
>
> --
> ~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~
>



-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net


Re: more match humility

2017-03-13 Thread ToddAndMargo

On 03/13/2017 09:16 PM, ToddAndMargo wrote:

What am I doing wrong now !?!?!  :'(  :'(  :'(


#!/usr/bin/perl6

sub Test () {

   my $f = $?FILE; say "\$\?FILE=<$f>";
   my $g = $?FILE.IO.basename;  say "\$\?FILE.IO.basename=<$g>";
   ( my $IAm = $?FILE ) ~~ s|.*"/"||; say "Regex \$IAm=<$IAm>";


   # sub Test () { #`(Sub|58588296) ... }
   my $h = &?ROUTINE;
   say "\&\?ROUTINE=<$h>\n";
   $h ~~ m/' '(.*?)' '\(/;
   say "This sub\'s name is <$0>";
}


Test();



$ WhoTest.pl6
$?FILE=
$?FILE.IO.basename=
Regex $IAm=
Sub object coerced to string (please use .gist or .perl to do that)
  in sub Test at ./WhoTest.pl6 line 12
&?ROUTINE=

No such method 'match' for invocant of type 'Sub'
  in sub Test at ./WhoTest.pl6 line 13
  in block  at ./WhoTest.pl6 line 18


&?ROUTINE






Figured it out with the help of the chat line.  I
need to add .gist onto &?ROUTINE so that regex sees
a string



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


more match humility

2017-03-13 Thread ToddAndMargo

What am I doing wrong now !?!?!  :'(  :'(  :'(


#!/usr/bin/perl6

sub Test () {

   my $f = $?FILE; say "\$\?FILE=<$f>";
   my $g = $?FILE.IO.basename;  say "\$\?FILE.IO.basename=<$g>";
   ( my $IAm = $?FILE ) ~~ s|.*"/"||; say "Regex \$IAm=<$IAm>";


   # sub Test () { #`(Sub|58588296) ... }
   my $h = &?ROUTINE;
   say "\&\?ROUTINE=<$h>\n";
   $h ~~ m/' '(.*?)' '\(/;
   say "This sub\'s name is <$0>";
}


Test();



$ WhoTest.pl6
$?FILE=
$?FILE.IO.basename=
Regex $IAm=
Sub object coerced to string (please use .gist or .perl to do that)
  in sub Test at ./WhoTest.pl6 line 12
&?ROUTINE=

No such method 'match' for invocant of type 'Sub'
  in sub Test at ./WhoTest.pl6 line 13
  in block  at ./WhoTest.pl6 line 18






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