Graham Barr <[EMAIL PROTECTED]> writes: > On Wed, Apr 10, 2002 at 01:35:22PM -0400, Mark J. Reed wrote: >> On Wed, Apr 10, 2002 at 10:30:25AM -0700, Glenn Linderman wrote: >> > method m1 >> > { >> > m2; # calls method m2 in the same class >> Yes, but does it call it as an instance method on the current invocant >> or as a class method with no invocant? If the former, how would you >> do the latter? > > This may be a case of keep up at the back, but if that is a method call, > how do I call a subroutine from within a method ?
And anyone who says "You don't" will receive a good hard talking to from me. Being able to declare private subroutines within classes is really useful, witness: class SchemeNumber is SchemeExpr { my sub apply($self: $target, $rhs, &block) { if $is_rhs { $self.new(+ &block( $target, $self.value )) } else { $self.new(+ &block( $self.value, $target )) } } method operator:+ { apply(*@_, {$^a + $^b}) } method operator:* { apply(*@_, {$^a * $^b}) } method operator:- { apply(*@_, {$^a * $^b}) } method operator:/ { apply(*@_, {$^a * $^b}) } method is_number { 1 } } Yes, I know there's several different ways I could do it, but this approach feels right. -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?