The Perl6 docs state "By default, parameters are bound to their argument and marked as read-only." But running the following code:
# Example 1
sub f1 ( $x ) { say $x.VAR.WHAT; say $x.WHAT; say $x }
f1(1);
yields:
(Scalar)
(Int)
1
while this code:
# Example 2
my $y := 1;
say $y.VAR.WHAT; say $y.WHAT; say $y;
yields:
(Int)
(Int)
1
It's the (Scalar)
in the output of Example1 that I do not understand: why is there a Scalar when I supposedly bind the Int 1 - argument to the identifier $x
? It seems as if the value 1
got "assigned" to $x
, rather than "bound".