[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GOOPS: define-method* with extended lambda-list-syntax?
From: |
Mikael Djurfeldt |
Subject: |
Re: GOOPS: define-method* with extended lambda-list-syntax? |
Date: |
Thu, 10 Apr 2003 11:49:06 +0200 |
User-agent: |
Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.2 (gnu/linux) |
Anders Vinjar <address@hidden> writes:
> A question for anyone having a better knowledge than me about
> development around GOOPS.
>
> In translating a piece of CLTL to Guile, I would need a
> procedure/macro define-method* which gives access to extended
> lambda-list syntax (ie. with #:optional #:key etc) parameters.
>
> Q: is there something like this available anywhere already?
No.
> Q2: if not, is having this in CLOS a big design-flaw, making my
> attempts here just silly?
I don't think they are silly.
> I did an attempt at building a define-method* macro, which sort
> of works, but it seems very inefficient.
Well, perhaps not very inefficient.
> (define-method* (f (x <real>) (y <top>) #:optional z)
> 'real-top)
>
> expands into 2 calls on add-method! - one with specialiser for
>
> (list <real> <top>)
>
> - the other for
>
> (list <real> <top> <top>)
>
> The procedure-slot is the same for both methods.
It might be good to "fold in" the functionality of lambda* so that you
can have some decisions already made by method dispatch.
> (defmacro define-method* (name-pars . body)
> (let ((name (car name-pars))
> (pars (cdr name-pars)))
> (multiple-value-bind
> (reqs opts rest keys aok? auxs)
> (parse-lambda-list pars)
> (let* ((specsr (map (lambda (y) (if (list? y) (cadr y)))
> reqs))
> (specs (append specsr
> (map (lambda (y)
> (if (cadr y)
> (class-name (class-of (cadr y)))
^^^^^^^^^^^
This seems strange to me. This implies that parse-lambda-list
evaluates the specializers (in order to obtain the class object). It
should probably not do that.
Best regards,
Mikael D.