Re: Keywords in define-method

Mikael Djurfeldt <[email protected]>
Newsgroups gmane.lisp.guile.user,gmane.lisp.guile.devel
Message-ID <CAA2XvwLSbDpURT3gyRcBYcVB0QFKKGxVrBxr66XyuG2mVja7gQ@mail.gmail.com>
Den tis 26 nov. 2024 00:51Mikael Djurfeldt <[email protected]> skrev:

> On Fri, Nov 22, 2024 at 1:20 PM <[email protected]> wrote:
>
>> ...which I think in your version, not having to use define-method*
>> feels more elegant/GOOPSy to me, as it's all overloads/generics,
>> but I have no strong opionion on this.
>>
>
> There's actually a secret to what I have committed:
>
> define-method* *is* the define-method you requested.
>
> So you can do, e.g.:
>
> (use-modules ((oop goops)
>               #:hide (define-method)
>               #:renamer (lambda (s) (if (eq? s 'define-method*)
> 'define-method s))))
>
> or
>
> (define-module (foo)
>   #:use-module ((oop goops)
>                 #:hide (define-method)
>                 #:renamer (lambda (s) (if (eq? s 'define-method*)
> 'define-method s))))
>
> and then
>
> (define-method (bar #:key x) x)
>
> For ordinary formals, like
>
> (define-method (baz x) ...)
>
> the resulting behavior and efficiency will be very close to identical.
>

That was a bit unclear. What I meant was that for ordinary formals
define-method* compiles almost as fast as define-method and:

The compiled code and type dispatch of the method will be identical to that
> produced by the original define-method macro.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.