[plt-scheme] class.ss inheritance

From: Neil W. Van Dyke (neil at neilvandyke.org)
Date: Tue Mar 18 21:13:33 EST 2003

In absence of multiple-inheritance in class.ss, I'm using interfaces
with composition and manual delegation for some of the is-a
relationships, such for the server-authority-haver<%>:

    (define http-uri%
      (class* hierarchical-uri% (server-authority-haver<%>)
        (field server-authority [...])
        (define/public (get-user) (send server-authority get-user))
        (define/public (get-host) (send server-authority get-host))
        (define/public (get-portnum)
          (send server-authority get-portnum/default 80))
        [...]))

With MI, I'd do something more like:

    (define http-uri%
      (class* (hierarchical-uri% server-authority-uri%) ()
        (define/override (default-portnum) 80)
        [...]))

Are there any class.ss tricks for doing something closer to the latter
example, such as a tricky way of approximating MI, or some convenience
for delegation?
 
-- 
                                             http://www.neilvandyke.org/


Posted on the users mailing list.