[plt-scheme] inner

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Sep 27 17:27:18 EDT 2004

At Mon, 27 Sep 2004 17:19:38 -0400, "Mike T. Machenry" wrote:
> Is it not possible to call the inner augmentation of a method from within a 
> another method of the class?

Yes, it's possible.

 > (define c% (class object% 
                (define/pubment (m) (inner 10 m))
                (super-new)))
 > (send (new c%) m)
 10
 > (define d% (class c% 
                (define/augment (m) (n)) 
                (define/public (n) (inner 12 m))
                (super-new)))
 > (send (new d%) m)
 12
 > (send (new d%) n)
 12
 > (define e% (class d%
                (define/augment (m) 14)
                (super-new)))
 > (send (new e%) n)
 14

If you don't declare the relevant method using `augment' or `pubment'
within the calling class, you'll have to use `rename-inner' instead of
`inner'. I haven't yet seen a case where that's useful, though.

Matthew



Posted on the users mailing list.