At 3:05 PM -0500 3/9/03, Uri Guttman wrote:
>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:

  >> so any class X that inherits from B must also modify the PARENT property
  >> in B? that sounds like PARENT is a hash of the classes which inherit
  >> from B.

  DS> Yep. Basically if the inheriting class is of a different type, such that
  DS> the parent class must be inherited with delegation, then when the parent
  DS> object is instantiated it gets the PARENT property on it. Messy in some
  DS> ways, but I don't see any way around it.

the use of 'inherit' with delegation bothers me. that assumes (some of)
the method names in the owned object are the same in the owner (parent)
object.

Yup. What I'm talking about here is delegation to implement inheritance, in those cases where the parent and child classes are structurally incompatible.


  >> how does that handle which methods in the 'owner' object get
  >> mapped/delegated to which methods in the 'owned' object? damian's
  >> delegate module has a map for that with owner method names mapping to
  >> attribute (owned object)/method pairs. not all methods of an owned
  >> object need to be accessible via the owner's interface. also how do you
  >> handle multiple owned objects and method mapping?

  DS> Ah, this isn't for the Damian "We do Interesting Things with delegation"
  DS> stuff. This mechanism is in specifically to handle inheriting from an
  DS> incompatible parent class. Stuff like Damian wants can be handled
  DS> completely in user-code, so it should be.

i assume by user code you mean perl6 itself?

Yep.


that can be done just
before method lookup is called but the mapping hash still has to be in
the object/class and private to that. can that be handled at the perl6
level without parrot support?

I don't plan on adding any special support for the fancy delegation tricks Damian plays. I don't think there's any real need--the standard AUTILOAD and shim creation tricks he plays to get it working will work just fine, so there's not much need for anything else.


  DS> At some point someone will come up with a clever general way to handle
  DS> this, in which case we'll look into rolling it into the base object
  DS> system, but for now, in the interests of what simplicity we can muster,
  DS> we're going to duck the issue.

it doesn't seem to be too hard. all that is needed is a OWNED/DELEGATED
hash with the method/delegated mappings provided by perl6. then that map
(if it exists) is checked before any other method lookups are done. this
is all i see that is needed to support proper delegation and it is
pretty much what damian's module does now. it can be added later if it
simplifies things now but it doesn't seem that complex or tricky.

I don't think the extra support will be difficult, I just think it's stuff we don't need to implement to get our required functionality. I also think it can be done entirely without extra engine support, so as such I'd as soon not do anything about it for now. We've more than enough to do as it is. :)
--
Dan


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

Reply via email to