Author: lwall
Date: 2009-06-09 19:43:18 +0200 (Tue, 09 Jun 2009)
New Revision: 27045

[S12] limit multi method effects to inside a class to preserve encapsulation
likewise .^methods describes a set of multi methods as a single method

Modified: docs/Perl6/Spec/S12-objects.pod
--- docs/Perl6/Spec/S12-objects.pod     2009-06-09 14:02:35 UTC (rev 27044)
+++ docs/Perl6/Spec/S12-objects.pod     2009-06-09 17:43:18 UTC (rev 27045)
@@ -12,8 +12,8 @@
   Maintainer: Larry Wall <>
   Date: 27 Oct 2004
-  Last Modified: 22 May 2009
-  Version: 83
+  Last Modified: 9 Jun 2009
+  Version: 84
 =head1 Overview
@@ -1024,6 +1024,18 @@
 single invocant, and any additional semicolons may only indicate long names
 to be used as tiebreakers.
+The multi-method tiebreaking happens only within a given class; all
+parent classes' multis appear to the outside world to be C<only>
+methods (and indeed, a foreign object may have no clue how to
+advertise multiple methods anyway).  In other words, longnames from
+different classes don't intermix as do the longnames in ordinary
+multi-sub dispatch.  So multi methods work only within a class;
+outside the class, single-dispatch semantics are enforced to preserve
+encapsulation.  To put it another way, multi methods are only for
+convenience of implementation within a given class; and specifically
+to make it easier to compose roles with similar but not identical
+methods into a single class.
 Conjecture: In order to specify dispatch that includes the return
 type context, it is necessary to place the return type before the double
@@ -1856,6 +1868,11 @@
     :tree               methods by class structure (inheritance hierarchy)
     :private            include private methods
+Note that, since introspection is primarily for use by the outside
+world (the class already knows its own structure, after all), a set of
+multi methods are presented to be a single C<Routine> object.  You need to
+use C<.candidates> on that to break it down further.
 The C<.^attributes> method returns a list of attribute descriptors
 that have traits like these:

Reply via email to