At 10:49 AM +0200 10/18/02, Leopold Toetsch wrote:
In perl.perl6.internals, you wrote:

 A "thing" has three parts, a name (which is optional), a container,
 and the contents of the container.
[ ... ]

 Well, first it means we need to conceptually split "variables" into
 three parts, rather than two as we have been.
Do you have a more verbose description of variable/value separation?
Sure. Aggregates are a good one. For example, let's assume you have an array that can only hold real objects. The objects are the values, while the array itself is the variable. You *must* go through the variable's vtable to find a value, while when you manipulate the data you need to use the vtable in the value.

Tied data's another one. If you tie a scalar, the variable is tied not the value in the variable. But whenever you access the data in the variable the variable needs to be involved in the fetch or store, while the value is what's involved with any actual manipulation.

 > It also means that we need to (or at least really should) split
 vtables up into parts, so we can pull them upwards as
 appropriate. That way we can promote vtable pieces where appropriate,
 when the value and variable are of the same type, to cut out dispatch
 overhead.
something like:

struct {
	can;
	has;
	isa;
	union {
	  scalar_vtable;
	  aggregate_vtable;
	  object_vtable;
	};
VTABLE;
Rather than a union, there'd be a set of pointers to various vtable pieces.

 > ... And in those cases where we can't do that, we can do the
 normal two-level access. (Though hopefully we can avoid it for most
 anything besides objects and aggregates)
verbose please
Well, with the design as it is, we theoretically need to go through the variable's vtable every time we need to act on the value in the variable--we have to do a fetch then dispatch through the fetched value's vtable to act on it.

What I'd like to be able to do is, for variables that are effectively passive and don't actually have to get involved, to skip that extra level of indirection and promote the value's vtable functions into the variable's vtable.
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk

Reply via email to