Perl6 Object Oriented Cookbook (v0.2.1)  
Section 5: Constructors, Destructors, and Autochained Methods  
 
Recipe 5.13: Creating an Autochained Method (Ascending)
Last Updated: Sep 8, 2003
Status: Draft
      Previous Page   Next Page

How important is this problem to you?
  (Login to Vote)
5.00 Rating, 1 Vote  

How acceptable is the proposed solution?
  (Login to Vote)
0.00 Rating, 0 Votes  

Problem:  

You want to create a method in your class that exhibits the same autochaining as object destructor methods. Whenever invoked, your method should be called first in your subclass, then in all parent classes, automatically.

Solution:  

Discussion:

(If Perl6 has code to perform autochaining of constructors/destructors, it might be nice to expose that to the user in such a way as to allow them to easily create other methods with similar behavior. It's a useful technique, after all.)

Issue: Is there any well-informed consensus on which direction should be called "descending" and which should be called "ascending"? :-)


Log In to Comment


Login / Edit User Info -- Copyright © 2002 Cognitivity -- Previous Page   Next Page