Strange behaviour in REPL

I want to test for a key being defined in one hash, and if it is, then 
it should be a hash, and I need the value of that second key.

So I was testing my syntax with raku and got the following:

raku
Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.12.
Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
Built on MoarVM version 2020.12.

To exit type 'exit' or '^D'
 > my %h = <one two three> Z=> 1..*
{one => 1, three => 3, two => 2}
 > %h<five> = %( this-key  => 'something' )
{this-key => something}
 > my $x
(Any)
 > with %h<five> { do with .<this-key> { $x = $_ } }
something
 > with %h<five> { do with .<this-key> { $x = $_ } }
===SORRY!===
Word 'with' interpreted as a listop; please use 'do with' to introduce 
the statement control word
at line 4
------> $ = with⏏ %h<five> { do with .<this-key> { $x = $
Unexpected block in infix position (two terms in a row)
at line 4
------> $ = with %h<five>⏏ { do with .<this-key> { $x = $_ } };

Note the lines begining with 'with'. Exactly the same line, executed 
twice, produces two significantly different answers.

I think this shouldn't happen.

0
rnhainsworth
1/11/2021 5:36:39 PM
perl.perl6.users 1545 articles. 0 followers. Follow

1 Replies
395 Views

Similar Articles

[PageSpeed] 18
Get it on Google Play
Get it on Apple App Store

Agree.

That's why I did https://github.com/rakudo/rakudo/commit/d53a927331 =
earlier today.

> On 11 Jan 2021, at 18:36, Richard Hainsworth <rnhainsworth@gmail.com> =
wrote:
>=20
> I want to test for a key being defined in one hash, and if it is, then =
it should be a hash, and I need the value of that second key.
>=20
> So I was testing my syntax with raku and got the following:
>=20
> raku
> Welcome to =F0=9D=90=91=F0=9D=90=9A=F0=9D=90=A4=F0=9D=90=AE=F0=9D=90=9D=F0=
=9D=90=A8=E2=84=A2 v2020.12.
> Implementing the =F0=9D=90=91=F0=9D=90=9A=F0=9D=90=A4=F0=9D=90=AE=E2=84=A2=
 programming language v6.d.
> Built on MoarVM version 2020.12.
>=20
> To exit type 'exit' or '^D'
> > my %h =3D <one two three> Z=3D> 1..*
> {one =3D> 1, three =3D> 3, two =3D> 2}
> > %h<five> =3D %( this-key  =3D> 'something' )
> {this-key =3D> something}
> > my $x
> (Any)
> > with %h<five> { do with .<this-key> { $x =3D $_ } }
> something
> > with %h<five> { do with .<this-key> { $x =3D $_ } }
> =3D=3D=3DSORRY!=3D=3D=3D
> Word 'with' interpreted as a listop; please use 'do with' to introduce =
the statement control word
> at line 4
> ------> $ =3D with=E2=8F=8F %h<five> { do with .<this-key> { $x =3D $
> Unexpected block in infix position (two terms in a row)
> at line 4
> ------> $ =3D with %h<five>=E2=8F=8F { do with .<this-key> { $x =3D $_ =
} };
>=20
> Note the lines begining with 'with'. Exactly the same line, executed =
twice, produces two significantly different answers.
>=20
> I think this shouldn't happen.
>=20

0
liz
1/11/2021 5:40:04 PM
Reply: