[MSLUG] Stupid Scheme Question

Dominique Boucher schemeway at sympatico.ca
Thu Dec 23 09:36:35 EST 2004


Francois,

 > 	Yes, a non-hygienic solution would be my preferred choice.

Then, what about the following (which would also eliminate the need
for eval):

(dboucher at Forman) (09:34:21) [personal] gsi
Gambit Version 4.0 beta 11

> (define-macro (defclass classname supername)
    (if (or (not (symbol? classname))
            (not (symbol? supername)))
        (error "invalid arguments to defclass"))
        `(begin
           ;; ** INSERT Class registering stuff here **
           (define-macro (,classname . expr)
             (let ((vars '((ContextClass ',classname)
                           (ContextSuperClass ',supername))))
               `(let ,vars , at expr)))))
> (defclass Window Object)
> (Window (list ContextClass ContextSuperClass))
(Window Object)
>

Dominique          
-- 
The Scheme Way Project
http://schemeway.sourceforge.net




More information about the MSLUG mailing list