Re: A12: on inheriting wrappers

2004-05-04 Thread Larry Wall
On Tue, May 04, 2004 at 03:41:58PM +0200, Aldo Calpini wrote: : but: what if Animal does inherits from something else? what I would like : to do (what I was trying to do with wrappers, that is) is to call the : inherited constructor, then do something with the returned object. : something like: :

Re: A12: on inheriting wrappers

2004-05-04 Thread Aldo Calpini
On Fri, 2004-04-30 at 19:01, Larry Wall wrote: > That would almost certainly fail with an error saying that it couldn't > find your &new subroutine. The & sigil does not imply dispatch, and > the default .new is inherited, not autogenerated, last I checked. :-) ouch. too true. so I guess my Ani

Re: A12: on inheriting wrappers

2004-04-30 Thread Larry Wall
On Fri, Apr 30, 2004 at 06:00:27PM +0200, Aldo Calpini wrote: : role Logging { : POST { : foreach ( ::_.meta.getmethods() ) -> $method { : $method.wrap( { : log($somewhere, "calling $method"); : call; :

Re: A12: on inheriting wrappers

2004-04-30 Thread Larry Wall
On Fri, Apr 30, 2004 at 11:14:55AM +0200, Aldo Calpini wrote: : class Animal { : our @.zoo; : &new.wrap( { : my @results = call(); : push(@.zoo, @results[0]); : return @results; : } ); : } That would almost certainly fail with an

Re: A12: on inheriting wrappers

2004-04-30 Thread Abhijit A. Mahabal
> > role Logging { > > POST { > > foreach ( ::_.meta.getmethods() ) -> $method { > > $method.wrap( { > > log($somewhere, "calling $method"); > > call; > > log($somewhere, "called $method"); > >

Re: A12: on inheriting wrappers

2004-04-30 Thread Abhijit A. Mahabal
On Fri, 30 Apr 2004, Aldo Calpini wrote: > so I wanted to explore the possible interoperability of wrappers and > classes. another example I can think of: > role Logging { > POST { > foreach ( ::_.meta.getmethods() ) -> $method { > $method.wrap( { >

Re: A12: on inheriting wrappers

2004-04-30 Thread Abhijit A. Mahabal
On Fri, 30 Apr 2004, Aldo Calpini wrote: > let's suppose I want to build a class that keeps track of the objects it > creates. > > let's suppose that I want this class to be the base for a variety of > classes. > > let's suppose that I decide, rather than fiddling with the default > constructor, t

Re: A12: on inheriting wrappers

2004-04-30 Thread Aldo Calpini
On Fri, 2004-04-30 at 16:59, Stéphane Payrard wrote: > Perl6 seems already to have plenty of mechanisms like delegation > to dynamically change the behavior of a class. So, probably, > wrappers is a mechanism more adapted to extend method behavior at > run-time by entities that don't have access to

Re: A12: on inheriting wrappers

2004-04-30 Thread Stéphane Payrard
On Fri, Apr 30, 2004 at 11:14:55AM +0200, Aldo Calpini wrote: > let's suppose I want to build a class that keeps track of the objects it > creates. > > let's suppose that I want this class to be the base for a variety of > classes. > > let's suppose that I decide, rather than fiddling with the

A12: on inheriting wrappers

2004-04-30 Thread Aldo Calpini
let's suppose I want to build a class that keeps track of the objects it creates. let's suppose that I want this class to be the base for a variety of classes. let's suppose that I decide, rather than fiddling with the default constructor, to wrap it up. something like: class Animal {