Front page | perl.perl6.users |
Postings from February 2020
Metamethods: WHERE
Thread Next
From:
Aureliano Guedes
Date:
February 12, 2020 12:45
Subject:
Metamethods: WHERE
Message ID:
CAG9gabQahvMiL7TmvHqDFp4JUx+A5FVA5iN12A_3ZRiBPuUM7Q@mail.gmail.com
What "WHERE" should return?
I was trying to find a method to return the memory address of some data.
Then I find the WHERE statement.
https://rosettacode.org/wiki/Address_of_a_variable#Perl_6
https://docs.perl6.org/language/mop#WHERE
Then I tested it.
I created $a, $b and $c, where $c is binded to $b as I show below.
The point is, I expected $c and $b returns the same address, and it returns
as expected, but $a has the same $b value it also returns the same value
when used WHERE.
What I'm doing wrong?
> my $a = 3;
3
> my $b = 3;
3
> my $c := $b;
3
> $a = 4;
4
> $b = 4;
4
> $c
4
> $c = 5
5
> $b
5
> $a.WHERE
94576802723392
> $b.WHERE
94576802723352
> $c.WHERE
94576802723352
> $b = 4 # back to same $a value
4
> $c
4
> $a.WHERE
94576802723392
> $c.WHERE
94576802723392
> $b.WHERE
94576802723392
--
Aureliano Guedes
skype: aureliano.guedes
contato: (11) 94292-6110
whatsapp +5511942926110
Thread Next
-
Metamethods: WHERE
by Aureliano Guedes