Rakudo CoreDev Class, session 2

2022-12-28 Thread Vadim Belman
Dear rakoons,

Since I have a Zoom meeting allocated for the class, the previously announced 
schedule for the second session remains the same: Jan 7, 2022. A bit more 
details can be found in a reddit post here: 
https://www.reddit.com/r/rakulang/comments/zxsmvy/rakudo_coredev_class_session_2

Google Calendar entry: 
https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MGdpYWNpZGNmdHMxZHYzNnA5bGJhdG5qc2IgMGZiMWQ4NTVlOWI2MTA3ZTlmZWM2OWE5ZTg4YjVhYjYxY2IwZmJmNGUxZTI0OTE3MDg2MjE1Yzc5NjkyMWNkYkBn&tmsrc=0fb1d855e9b6107e9fec69a9e88b5ab61cb0fbf4e1e24917086215c796921cdb%40group.calendar.google.com

And just the Zoom meeting information follows:

Link: 
https://us02web.zoom.us/j/86809566554?pwd=THFWSzRrMzRRbE5aUm9wcWFuTUhaQT09 

Meeting ID: 868 0956 6554
Passcode: 540167


Happy coming New Year!

Best regards,
Vadim Belman



Re: $/ not always set after a regex match?

2022-12-28 Thread Elizabeth Mattijsen
Yes, for that code it would have to.

But that code pattern is really from Perl, and predates `with`.

$ raku -e 'say .Str with 9 ~~ /9/'
9

And I think that is what we should be teaching people to use, rather than 
depend on the magic lexical $/.

Liz

> On 28 Dec 2022, at 21:37, William Michels  wrote:
> 
> Doesn't it have to? At least for the following case? 
> 
> [0] > #REPL
> Nil
> [0] > say $/.Str if 9 ~~ /9/;
> 9
> 
> Best regards. --B
> 
> On Wed, Dec 28, 2022, 09:49 Elizabeth Mattijsen  wrote:
> That's because it at one time was decided that smart-match would set $/ in 
> the caller's scope.  Which is a pain for implementation and optimizations.  I 
> would be very much in favour of getting rid of that "feature", fwiw.
> 
>> On 28 Dec 2022, at 18:45, Sean McAfee  wrote:
>> 
>> But if a sequence has its own $/, why does * ~~ /9/ set $/?
>> 
>> Actually it's not just sequences, as a little more experimentation showed:
>> 
>> [0] > first /9/, ^Inf
>> 9
>> [1] > $/
>> Nil
>> [2] > grep /9/, ^10
>> (9)
>> [3] > $/
>> Nil
>> 
>> The * ~~ "trick" sets $/ in these cases too.
>> 
>> 
>> On Wed, Dec 28, 2022 at 12:01 PM Elizabeth Mattijsen  wrote:
>> This isn't specific to the REPL:
>> 
>> $ raku -e 'say 1 ... /9/; say $/'
>> (1 2 3 4 5 6 7 8 9)
>> Nil
>> 
>> I can only assume that the sequence has its own scope for $/, and thus isn't 
>> visible outside of it.
>> 
>> 
>> Liz
>> 
>>> On 28 Dec 2022, at 16:47, Sean McAfee  wrote:
>>> 
>>> In a fresh 2022.12 Raku REPL, when the endpoint of a sequence is a Regex, 
>>> the $/ variable seems not to be set:
>>> 
>>> [0] > 1 ... /9/
>>> (1 2 3 4 5 6 7 8 9)
>>> [1] > $/
>>> Nil
>>> 
>>> If I match more explicitly using a WhateverCode, it works:
>>> 
>>> [2] > 1 ... * ~~ /9/
>>> (1 2 3 4 5 6 7 8 9)
>>> [3] > $/
>>> 「9」
>>> 
>>> Is this the intended behavior, or a bug?
>>> 
>> 
> 



Re: $/ not always set after a regex match?

2022-12-28 Thread William Michels via perl6-users
Doesn't it have to? At least for the following case?

[0] > #REPL
Nil
[0] > say $/.Str if 9 ~~ /9/;
9

Best regards. --B

On Wed, Dec 28, 2022, 09:49 Elizabeth Mattijsen  wrote:

> That's because it at one time was decided that smart-match would set $/ in
> the caller's scope.  Which is a pain for implementation and optimizations.
> I would be very much in favour of getting rid of that "feature", fwiw.
>
> > On 28 Dec 2022, at 18:45, Sean McAfee  wrote:
> >
> > But if a sequence has its own $/, why does * ~~ /9/ set $/?
> >
> > Actually it's not just sequences, as a little more experimentation
> showed:
> >
> > [0] > first /9/, ^Inf
> > 9
> > [1] > $/
> > Nil
> > [2] > grep /9/, ^10
> > (9)
> > [3] > $/
> > Nil
> >
> > The * ~~ "trick" sets $/ in these cases too.
> >
> >
> > On Wed, Dec 28, 2022 at 12:01 PM Elizabeth Mattijsen 
> wrote:
> > This isn't specific to the REPL:
> >
> > $ raku -e 'say 1 ... /9/; say $/'
> > (1 2 3 4 5 6 7 8 9)
> > Nil
> >
> > I can only assume that the sequence has its own scope for $/, and thus
> isn't visible outside of it.
> >
> >
> > Liz
> >
> > > On 28 Dec 2022, at 16:47, Sean McAfee  wrote:
> > >
> > > In a fresh 2022.12 Raku REPL, when the endpoint of a sequence is a
> Regex, the $/ variable seems not to be set:
> > >
> > > [0] > 1 ... /9/
> > > (1 2 3 4 5 6 7 8 9)
> > > [1] > $/
> > > Nil
> > >
> > > If I match more explicitly using a WhateverCode, it works:
> > >
> > > [2] > 1 ... * ~~ /9/
> > > (1 2 3 4 5 6 7 8 9)
> > > [3] > $/
> > > 「9」
> > >
> > > Is this the intended behavior, or a bug?
> > >
> >
>
>


Re: $/ not always set after a regex match?

2022-12-28 Thread Elizabeth Mattijsen
That's because it at one time was decided that smart-match would set $/ in the 
caller's scope.  Which is a pain for implementation and optimizations.  I would 
be very much in favour of getting rid of that "feature", fwiw.

> On 28 Dec 2022, at 18:45, Sean McAfee  wrote:
> 
> But if a sequence has its own $/, why does * ~~ /9/ set $/?
> 
> Actually it's not just sequences, as a little more experimentation showed:
> 
> [0] > first /9/, ^Inf
> 9
> [1] > $/
> Nil
> [2] > grep /9/, ^10
> (9)
> [3] > $/
> Nil
> 
> The * ~~ "trick" sets $/ in these cases too.
> 
> 
> On Wed, Dec 28, 2022 at 12:01 PM Elizabeth Mattijsen  wrote:
> This isn't specific to the REPL:
> 
> $ raku -e 'say 1 ... /9/; say $/'
> (1 2 3 4 5 6 7 8 9)
> Nil
> 
> I can only assume that the sequence has its own scope for $/, and thus isn't 
> visible outside of it.
> 
> 
> Liz
> 
> > On 28 Dec 2022, at 16:47, Sean McAfee  wrote:
> > 
> > In a fresh 2022.12 Raku REPL, when the endpoint of a sequence is a Regex, 
> > the $/ variable seems not to be set:
> > 
> > [0] > 1 ... /9/
> > (1 2 3 4 5 6 7 8 9)
> > [1] > $/
> > Nil
> > 
> > If I match more explicitly using a WhateverCode, it works:
> > 
> > [2] > 1 ... * ~~ /9/
> > (1 2 3 4 5 6 7 8 9)
> > [3] > $/
> > 「9」
> > 
> > Is this the intended behavior, or a bug?
> > 
> 



Re: $/ not always set after a regex match?

2022-12-28 Thread Sean McAfee
But if a sequence has its own $/, why does * ~~ /9/ set $/?

Actually it's not just sequences, as a little more experimentation showed:

[0] > first /9/, ^Inf
9
[1] > $/
Nil
[2] > grep /9/, ^10
(9)
[3] > $/
Nil

The * ~~ "trick" sets $/ in these cases too.


On Wed, Dec 28, 2022 at 12:01 PM Elizabeth Mattijsen  wrote:

> This isn't specific to the REPL:
>
> $ raku -e 'say 1 ... /9/; say $/'
> (1 2 3 4 5 6 7 8 9)
> Nil
>
> I can only assume that the sequence has its own scope for $/, and thus
> isn't visible outside of it.
>
>
> Liz
>
> > On 28 Dec 2022, at 16:47, Sean McAfee  wrote:
> >
> > In a fresh 2022.12 Raku REPL, when the endpoint of a sequence is a
> Regex, the $/ variable seems not to be set:
> >
> > [0] > 1 ... /9/
> > (1 2 3 4 5 6 7 8 9)
> > [1] > $/
> > Nil
> >
> > If I match more explicitly using a WhateverCode, it works:
> >
> > [2] > 1 ... * ~~ /9/
> > (1 2 3 4 5 6 7 8 9)
> > [3] > $/
> > 「9」
> >
> > Is this the intended behavior, or a bug?
> >
>
>


Re: $/ not always set after a regex match?

2022-12-28 Thread Elizabeth Mattijsen
This isn't specific to the REPL:

$ raku -e 'say 1 ... /9/; say $/'
(1 2 3 4 5 6 7 8 9)
Nil

I can only assume that the sequence has its own scope for $/, and thus isn't 
visible outside of it.


Liz

> On 28 Dec 2022, at 16:47, Sean McAfee  wrote:
> 
> In a fresh 2022.12 Raku REPL, when the endpoint of a sequence is a Regex, the 
> $/ variable seems not to be set:
> 
> [0] > 1 ... /9/
> (1 2 3 4 5 6 7 8 9)
> [1] > $/
> Nil
> 
> If I match more explicitly using a WhateverCode, it works:
> 
> [2] > 1 ... * ~~ /9/
> (1 2 3 4 5 6 7 8 9)
> [3] > $/
> 「9」
> 
> Is this the intended behavior, or a bug?
> 



$/ not always set after a regex match?

2022-12-28 Thread Sean McAfee
In a fresh 2022.12 Raku REPL, when the endpoint of a sequence is a Regex,
the $/ variable seems not to be set:

[0] > 1 ... /9/
(1 2 3 4 5 6 7 8 9)
[1] > $/
Nil

If I match more explicitly using a WhateverCode, it works:

[2] > 1 ... * ~~ /9/
(1 2 3 4 5 6 7 8 9)
[3] > $/
「9」

Is this the intended behavior, or a bug?