HaloO,
John M. Dlugosz wrote:
I'm assuming that the container defines what item assignment means. At
the very least, it will have the STORE method. But I want to have
infix:<=> definable in general without having to make it masquerade as
an Item Container.
I strongly agree with that. It should not be the case that an assignment
$x = $y;
is compiled down to
$x.STORE($y.FETCH);
That is, the assignment is a mere syntactic device. The above procedure
should be wrapped in the default implementation
multi infix:<=> (Any $lhs is rw, Any $rhs)
{
$x.STORE($y.FETCH);
}
Note that due to contravariance the type constraint of $lhs should
actually be the bottom type not Any. OTOH rw is invariant in general.
Only here in assignment the $lhs is write-only. But Perl 6 hasn't
specced that trait on parameters.
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