develooper Front page | perl.perl6.language | Postings from May 2005

Method overloading, MMD/SMD

From:
Yuval Kogman
Date:
May 27, 2005 03:15
Subject:
Method overloading, MMD/SMD
Message ID:
20050527101517.GA8694@woobling.org
In Synopsis 13 MMD is discussed as the mechanism for overloading an
operator.

Many a times I would like to overload a method of a class.

I just played around with this:

	http://svn.openfoundry.org/pugs/modules/Class-Events/lib/Class/Events.pm

Notice how the Named event variation appends the role, adding some
more specific signatures to familiar functions, to increase
dwimmery.

How do i get this to behave?

Do I need to say all the methods that can ever be overloaded are
multi? Or do I say that only the overloading ones are multi? If the
first - how do I get a delegation to be multi? Does that rely on the
delegation handler method?

Also, is SMD not possibly representable in MMD? Is SMD a subset of
MMD or a completely different system?

Also on a side note, say I have two roles, both of which define the
private attribute $.:horse. Do these attributes conflict, or does
each role get it's own slot? What about MI/mixins?

Grazie

-- 
 ()  Yuval Kogman <nothingmuch@woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me tips over a cow: neeyah!!!!!!!!!!!!!!!!!!!!!!




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About