Dan Sugalski wrote: > First, for simple X = Y cases, we need a new assignment opcode. We > have SET to copy pointers, CLONE to make full clones, but we don't > have a method to stuff a value from one PMC to another. > So, what we need to do is add ASSIGN Px, Py, which takes Px and calls > set_pmc with Py as a parameter. At that point, it's up to Px's vtable > to decide what to do with the incoming data. > For assignment in general, it's up to the assignee to decide what to > do with the incoming data. In most cases it'll either be a morph > (which the destination will take care of), a value copy (if the > destination type is fixed), or some sort of Weird Magic (for tied > variables). We may want to implement multimethod dispatch for > assignment. > This includes all forms of assignment, not just the ASSIGN op kind. > When we do an ADD Px, Py, Pz, we're calling Px's set_pmc vtable entry > with a PMC that represents the addition of Y and Z. Whether X changes > its type is entirely up to it, as that's what it's supposed to > determine.
So this means that ADD will have to create a temporary PMC to hold the result which it then passes to set_pmc ? What does set_pmc then do, in the case of a normal assignment with no magic or fixed type in order to perform the assignment ? -- Jason