Den tis 26 nov. 2024 00:51Mikael Djurfeldt <mik...@djurfeldt.com> skrev:
> On Fri, Nov 22, 2024 at 1:20 PM <jann...@gnu.org> 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.
>

Reply via email to