Chromatic wrote:
[snip]
> > I think you want to declare "I comply with ruleset X" at the callee
> > object level. That enables the compiler to (1) check that you're not
> > lying; and (2) optimize based on (1).
> 
> At least one of us is using "caller/callee" in the X11 sense.  What I
> mean and what I think you mean is:
> 
>         method foo ( Thingie $t ) { ... }
> 
>         $object->foo( $behaves_like_thingie );
> 
> foo() says, "Give me something that I can treat like a Thingie.  I
> don't care HOW it does it, I just want it to do something sane."
> 
> $behaves_like_thingie is an instance of a class that somehow says,
> "Hey, I act like Thingie.  I'm substitutable for Thingie if you don't
> break my encapsulation."

If this were Java, the way to do this would be to define a Thingie
interface, and then an (archetypical) ThingieObject class... any time
that we want to actually *create* Thingies, we would use "new
ThingieObject", but everywhere else, we would use the typename
"Thingie".  This way, when we want a class which "acts like" a Thingie,
but without inheriting any of it's innards, simply implement the Thingie
interface, instead of inheriting the ThingyObject class.

<idea type=wierd>
Here's a possible idea -- have a method of the Class class, which
returns (creates) an anonymous Interface object, which provides all of
the public methods of that class, and which is magically one of the
parents of that class.

This way, when one wants to define a new class X which "acts like" some
other class Y, but which doesn't *really* inherit from Y (none of the
internal data, etc.), we can define X as implementing the Y.interface()
Interface.  For our "isa" operator, and (perhaps more importantly) for
multimethod dispatch and/or sub prototype checking, we only check if an
object inherits from a class's magic parent interface, and *don't* check
if it *really* inherits from that class itself.
</idea>

Of course, this by itself wouldn't let us delegate to the ThingyObject's
versions of the methods... that would require another extra layer of
nonsense^Windirection.


> If we're just confused over a bit of terminology, we're in violent
> agreement on the idea, which is much more important.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "[EMAIL PROTECTED]
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}

Reply via email to