[plt-scheme] Object system vs. closures

From: Lieven De Keyzer (lieven.dekeyzer at gmail.com)
Date: Tue Mar 11 05:21:26 EDT 2008

I'm wondering: what are the advantages and disadvantages of using the
mzScheme object system instead of using closures to support OO?
One of the disadvantages is portability I guess?

Examples:

(define test%
  (class object%)

  (public method)

  (define (method)
    ...)

  (super-new))

or

(define (make-test)

  (define (method)
    ...)

  (define (dispatch m)
    (cond ((eq? m 'method) method)
          (else (error "unknown message"))))

  dispatch)

Thanks,
Lieven


Posted on the users mailing list.