HaloO,

John M. Dlugosz wrote:
Daniel Ruoso daniel-at-ruoso.com |Perl 6| wrote:
  %a<b> := 1;

is an operation in the hash itself, not in that specific cell of the
hash.

This to me implies that postcircumfix:{'<','>'} returns some
assignment proxy that knows the hash. This is e.g. needed for
autovivification which happens in lvalue context but not in
rvalue context.



What?


Nothing in S02, S03 or S06 suggests such a usage. := is used to alias a "name" The expression on the left does not name a variable, but is an expression.

I would think that binding is the high level equivalent to pointer
assignment. Since %a<b> is a proper lvalue binding can just assign
the lvalue from the right hand side to the left. Daniel's statement
above implies that the hash providing the lvalue location is involved
in this process. I would expect that

   my $x = 'foo';
   my %a<b> := $x; # does \$x work as well?
   %a<b> = 'from hash';
   say $x; # prints 'from hash'

works as indicated. Note that Perl 6 dropped the Perl 5 references.
%a<b> = \$x is still valid syntax but stores a capture of $x which
is not modifiable, IIRC. Or would the code sequence above work also
with a capture instead of binding?


Regards, TSa.
--

"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to