[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: namespaces, goops, etc.

From: Mikael Djurfeldt
Subject: Re: namespaces, goops, etc.
Date: 07 Nov 2000 01:32:58 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

"Lars J. Aas" <address@hidden> writes:

> I can imagine it could be useful with local generic methods in
> certain circumstances...

(use-syntax (ice-9 syncase))
(use-modules (oop goops))

(define-syntax let-generic
  (syntax-rules ()
    ((let-generic name ((formals method-body ...) ...) body ...)
     (let ((name (make-generic)))
       (add-method! name (method formals method-body ...)) ...
       body ...))))

(define (foo)
  (let-generic foo ((((x <number>)) (+ 1 x))
                    (((x <string>)) (string-append x x)))
               (list (foo 1) (foo "*"))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]