[racket] Declaring methods and fields with internal and external names
How is this:
#lang racket
(define graph%
(class object%
(field ((n nodes) '()))
(public (get get-fields))
(define/public (all) (get))
(define (get) n)
(super-new)))
(define graph (new graph%))
(define fields (get-field nodes graph))
(equal? (send graph get-fields) fields)
(equal? (send graph all) fields)
On Jan 12, 2013, at 2:50 PM, Harry Spier wrote:
> The Racket reference says:
> 5.2.3.3 Internal and External Names
>
> Each method declared with public, override, augment, pubment,
> overment, augride, public-final, override-final, augment-final,
> inherit, inherit/super, inherit/inner, rename-super, and rename-inner
> can have separate internal and external names when (internal-id
> external-id) is used for declaring the method. The internal name is
> used to access the method directly within the class expression
> (including within super or inner forms), while the external name is
> used with send and generic (see Field and Method Access). If a single
> id is provided for a method declaration, the identifier is used for
> both the internal and external names.
> ...
> ...
> Each init, init-field, field, or inherit-field variable similarly has
> an internal and an external name.
> -----------------------
>
> I'm still unclear how to do this. If a list member could show me a
> simple example of declaring a method and also a field with separate
> internal and external names I'd greatly appreciate it.
>
> Harry Spier
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users