| |
perl.perl6.language |
Greetings. In implementing :=, I have discovered two different The "linking" semantic is akin to hard links in filesystems. $x := $x; # no-op The "thunking" semantic is akin to symbolic links in filesystems. $endpos := $string.chars; # thunk, changes as $string changes Now, those two semantics directly clash when the RHS can be my ($x, @a); Under the linking semantic, there is no location in RHS to bind yet. Assuming the thunking semantics however, I am not too sure about how ($x, $y) := ($y, $x); # swap? One interpretation is that the RHS pad bindings are snapshotted, my ($x, @a); Okay, that looks good to me. Should I go ahead and implement Thanks,
set of semantics in explantations. I will refer them as "linking" and
"thunking".
It takes the storage location in the RHS and binds its to the
name in the LHS:
($x, $y) := ($y, $x); # swap
It takes the expression in RHS and wraps it in an implicit closure,
then give that closure a name to be triggered later.
A12 has an example:
interpreted both ways. One good example would be array dereference:
$x := @a[-1];
@a = (1..100);
say $x;
One possible interpretation is just autovivify it -- but [-1] is not
autovivifiable, so it should throw out an fatal exception under the
linking semantic right there. Under the thunking semantic, of course,
it will work as expected.
this can possibly work:
so future calls to $x always evaluates the bound "$y" at the RHS
context, and hence give correct results. This would mean:
$x := @a[0];
@a := ($x, $x, $x);
$x := 1;
say @a; # (undef, undef, undef)
the thunking semantics?
/Autrijus/
|
|
application_pgp-signature_part < 1K Download |