unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <mikael@djurfeldt.com>
To: Jan Nieuwenhuizen <janneke@gnu.org>
Cc: guile-devel <guile-devel@gnu.org>,
	guile-user <guile-user@gnu.org>,
	 Mikael Djurfeldt <mikael@djurfeldt.com>,
	David Pirotte <david@altosw.be>, Tomas Volf <~@wolfsden.cz>
Subject: Keywords in define-method
Date: Tue, 26 Nov 2024 00:51:51 +0100	[thread overview]
Message-ID: <CAA2XvwJKag7oMWKa2NXsVgbDOn1=HjTA+k7dXrign1OrkgQhYA@mail.gmail.com> (raw)
In-Reply-To: <87h67zxxxn.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

On Fri, Nov 22, 2024 at 1:20 PM <janneke@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. The
compiled code and type dispatch of the method will be identical to that
produced by the original define-method macro.

Best regards,
Mikael

[-- Attachment #2: Type: text/html, Size: 2152 bytes --]

  parent reply	other threads:[~2024-11-25 23:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 16:41 Keywords in GOOPS methods Mikael Djurfeldt
2024-11-21 20:33 ` Mikael Djurfeldt
2024-11-21 20:33   ` Mikael Djurfeldt
2024-11-21 22:00   ` janneke
2024-11-21 22:51     ` Mikael Djurfeldt
2024-11-22 11:46       ` Tomas Volf
2024-11-22 12:28         ` Mikael Djurfeldt
2024-11-22 12:20       ` janneke
2024-11-22 12:29         ` Mikael Djurfeldt
2024-11-22 23:04           ` Mikael Djurfeldt
2024-11-25 23:51         ` Mikael Djurfeldt [this message]
2024-11-26  0:13           ` Keywords in define-method Mikael Djurfeldt
2024-11-26  9:33             ` Mikael Djurfeldt
2024-11-26 18:40               ` Mikael Djurfeldt
2024-11-23 15:31       ` Keywords in GOOPS methods Maxime Devos via General Guile related discussions
2024-11-23 15:41         ` Mikael Djurfeldt
2024-11-23 15:49           ` Maxime Devos via General Guile related discussions
2024-11-24 11:56             ` Mikael Djurfeldt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA2XvwJKag7oMWKa2NXsVgbDOn1=HjTA+k7dXrign1OrkgQhYA@mail.gmail.com' \
    --to=mikael@djurfeldt.com \
    --cc=david@altosw.be \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=janneke@gnu.org \
    --cc=~@wolfsden.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).