HaloO,

I fear I'm addicted...

Luke Palmer wrote:
On 10/7/05, chromatic <[EMAIL PROTECTED]> wrote:

On Fri, 2005-10-07 at 17:43 -0600, Luke Palmer wrote:


No, you can't overload assignment at runtime because you can't
overload assigment at any time, so says the language spec (well, not
any formal spec; so says Larry as far as I remember).

Again, I don't care *how* I accomplish it, as long as I don't have to
root around in the source code of Perl 6 itself to make it work.


That's easy.  Define coerce:<as> (Int --> Array) {...}.  Don't define
it after CHECK is run.

But that makes MMD at most a second class concept.
Worse is that this hinders the concrete formulation
of abstract concepts into which designers can hook their
stuff. Assignment to me is a non-commutative, or if you
like that better, asymmetric binary operator. The asymmetry
beeing that the LHS takes the burden to keep the connection
to the value of the RHS at that time.

I call the thing that Larry wants to preserve a slot call.
That is

  $x = $y;

actually means

  $x.STORE( $y.FETCH );

where I would write the .STORE and .FETCH methods with
adverbial pair syntax :STORE and :FETCH because they
are looked up from the things that $x and $y contain or
refer to at runtime while the dot forms are dispatched
on the type. In other words the generated code is different
in both cases. But usually the net result is the same because
the .STORE method has the same targets for the usual types
of $x as the vtbls that different types of $x carry around.

BUT you can break that symmetry *either* by changing the entries
in the method *or* some vtbls! And if you want to base your
decision which route to take on *both* the participants you
write a *multi* method for infix:{'='}.

And only if none of the above is satisfactory messing with the
parser/grammar should be considered. I have the impression that
Perl 6 pulls out this rather heavy-weight tool too early in many
cases.
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to