Perl6 Object Oriented Cookbook (v0.2.1)  
Section 5: Constructors, Destructors, and Autochained Methods  
 
Recipe 5.12: Creating an Autochained Method (Descending)
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 constructor methods. Whenever invoked, your method should be called first in parent classes, then in your subclass, 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