[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ports and morphs



Rainer Blome wrote:
> 
> Jecel wrote:
> 
> > The problem is how to be able to change the color of these
> > two objects together but not that third one. I have an idea
> 
> Seems like the perfect opportunity for multiple inheritance,
> doesn't it?  Put the shared properties in a `graphics parent':
> 
> (| group-props = (| color = a_paint.  origin = 10@20.  |).
> 
>    left-side = (| graphics-parent* = group-props.
>    -- will not work, literals are evalled in lobby
>    -- context, but you get the idea
>                   parent* = traits foo_morph.
>                   leftish stuff ... .
>                   |).
> 
>    right-side = (| graphics-parent* = group-props.
>                    parent* = traits bar_morph.
>                    rightish stuff ... .
>                    |).
>    ... .
>    |)
> 
> Anything wrong with this?

The problem is that you will create hundreds of
twisty little objects, all different. That will
certainly put a huge strain on your compiled
code cache.

In fact, this is just an implementation of the
wrapper idea. This becomes much easier to see if
you use dynamic inheritance: ( | graphicsParent* <-.....
You will no longer have a problem with the code
cache as now there will only be a few types of
objects, but performance will be terrible on most
Self implementations.

Another problem with using static inheritance is
that most objects will be created by dragging morphs
around with the mouse, not by typing in expressions
like your example. These automatically generated
objects will be harder for the user to understand.

While I am pointing out some problems, it doesn't
mean I think it is not a good idea.

-- Jecel