Dan Sugalski wrote:
> Do we want to allow a variable to have multiple types of magic on it
> simultaneously?

Absolutely. It's a design requirement.

Fortunately with vtbls it's easy -- we just use mix-ins. Mix-ins are
partial implementations of a type that are designed to be merged into
a full implementation of another type. For example, there could be
a "tracing" mix-in which just defines the assignment op. When this is
mixed into an existing type the old assignment op is saved and the
mix-in assignment op takes its place. (Whether to save or not is the
responsibility of the mix-in type.)

If we don't want global changes (all objects of a type get the new
behavior), we have to build a new type. Unfortunately the order that
mix-ins are applied change the type.

- Ken

Reply via email to