On Tue, Aug 08, 2006 at 11:35:30 +0000, Luke Palmer wrote: > On 8/8/06, Yuval Kogman <[EMAIL PROTECTED]> wrote: > >I personally prefer delegates for almost any design dillema, but > >most CPAN modules aren't that way. > > Well, what way are they?
Usually not polymorphic at all. We have the capabilities to do very flexible polymorphism with delegation today. Roles aren't necessary from a purist perspective, they just make it much easier to do very flexible polymorphism more often since it'll be easier. > How else has this problem been solved? I dunno... > If a function declares a > parameter as a SomeAPI and then passes it on to a helper function, > which leaves it untyped, which then calls header, what happens? > > Since your proposal is lexical, SomeOtherAPI's is called, which is > probably not what was intended. My original idea was that this is again an ambiguity error - without the helper function stating which role it's using it cannot dispatch the "header" method at all, since it's in a role-conflicted state. -- Yuval Kogman <[EMAIL PROTECTED]> http://nothingmuch.woobling.org 0xEBD27418
Description: PGP signature