Brad Bowman wrote:
> Mark Stosberg wrote:
>> In the Objects chapter, a WALK pseudo-class is spec'ed for using
>> when calling sets of methods:
>>
>>   http://feather.perl6.nl/syn/S12.html#Calling_sets_of_methods
>>
>> These are the arguments listed that can be used with WALK:
>>
>>     :canonical      # canonical dispatch order
>>     :ascendant      # most-derived first, like destruction order
>>     :descendant     # least-derived first, like construction order
>>     :preorder       # like Perl 5 dispatch
>>     :breadth        # like multi dispatch
>>
>> First, it would be nice if the comments "like Perl 5" and "like multi
>> dispatch" could be expanded, if only to provide references to their
>> complete specs. Also, if "canonical" means something besides "I don't
>> care", it would be nice to have a reference for that, too.
> 
> I think Class::C3 on CPAN describes and implements the Perl 6 dispatch
> algorithm in Perl 5.  I don't know if it's in the Synopses, etc.

So that would the "preorder" or the "canonical" case. In either case,
since multi methods don't (normally) exist in Perl 5, it's still not
clear what order multi methods will be resolved in.

>> My concern for the moment is clarification how these options can be
>> combined. Clearly, combining ":ascendant" and ":descendant" doesn't make
>> sense.
>>
>> But, I assume a "self.*meth" call can work along both the inheritance
>> axis and the multi method access.
>>
>> Therefore, it seems fair to combine one option that affects each axis.
> 
> Wouldn't ":breadth" just be the breadth first order of the same set
> of methods?  Mentioning multi dispatch kind of confusing...
> 
> So I think the permitted combinations are:
> 
> One sorting adverb (defaulting to :canonical):
>     :canonical, :ascendant, :descendant, :preorder, :breadth
> 
> Some number of filtering adverbs:
>     :super              # only immediate parent classes
>     :method<name>       # only classes containing method declaration
>     :omit(Selector)     # only classes that don't match selector
>     :include(Selector)  # only classes that match selector

I agree in general, but still wonder about how the details sorting
adverbs apply to multi methods AND inherited methods.

> I'd like to be able to access the list of methods returned by
> the WALK traversal. Perhaps it is:
> 
>   @methods = $object.*WALK::can('meth');

That looks potentially useful. The "use case" might be checking to see
which which methods /might/ be called and then perhaps changing or
avoiding the method set call based on the result.

      Mark

Reply via email to