From: Mikael Djurfeldt <mikael@djurfeldt.com>
To: "Mikael Djurfeldt" <mikael@djurfeldt.com>,
janneke@gnu.org, guile-devel <guile-devel@gnu.org>,
"Ludovic Courtès" <ludo@gnu.org>, guile-user <guile-user@gnu.org>,
"Andy Wingo" <wingo@pobox.com>
Subject: Re: Keywords in GOOPS methods
Date: Fri, 22 Nov 2024 13:28:34 +0100 [thread overview]
Message-ID: <CAA2XvwLaFJAzR+=iFZpBrXRw=oMDnwnqwM3=0Oc6FBq5ZQExPw@mail.gmail.com> (raw)
In-Reply-To: <8734jj1oey.fsf@wolfsden.cz>
[-- Attachment #1: Type: text/plain, Size: 3078 bytes --]
Hi Tomas,
Thank you for your feedback. Answers below.
On Fri, Nov 22, 2024 at 12:46 PM Tomas Volf <~@wolfsden.cz> wrote:
> I do find the symmetry between define-method/define-method* and
> define/define* pleasing.
>
Yes, I guess we are free to form GOOPS in our own style regardless of CLOS.
> For define and define*, one could argue that procedures produced by the
> latter are slower to call (I did measure). Is that an issue here as
> well?
Well, the implementation in my patch essentially does the same amount of
work as the old one, and when not using keywords a call is as efficient.
Generic function dispatch should be unaffected, as with Marks macro.
However, there will be the same kind of overhead as for define* in calls
actually using keywords.
I checked what the optimizer can do with the resulting method when using
Marks elegant macro. Unfortunately, such a method would have overhead.
However, I do think that a modified version of Marks macro together with a
small change in peval could have a chance not to introduce such overhead.
All, in all, it currently (and paradoxically) turns out to be simpler to
provide the keyword functionality in define-method rather than also
providing define-method* if one doesn't want to introduce overhead for the
most common types of methods.
Perhaps I could try to learn what is going on in peval and see if a macro
similar to Marks would be the most elegant way to go forward.
You did mention backwards compatibility, but how serious you expect the
> issue would be? I personally did not use GOOPS yet, but I have a hard
> time imagining a real-world code that would be broken by this change.
> Do you expect there would actually be any?
>
I said "backwards compatibility perspective" and was too lazy to spell out
what I meant, which is this: Assume that we *now* want to write backwards
compatible code. Then, if we have *not* modified define-method we can be
certain that as long as we use define-method, we will be backwards
compatible. However, if we introduce keywords in define-method (rather than
define-method*) this is no longer true. If this new functionality is
confined to define-method*, then a future code can test for the presence of
defined-method* in Guile and otherwise provide something similar to Marks
(or Anders Vinjars from April 2003 :-)) macro.
>
> I personally would probably lean towards two separate procedures (mainly
> due to the assumption of there being a performance impact).
>
Well, there is none now that we have Andys remarkable compiler. Now also
Janneke has responded and he prefers to have everything in define-method.
Myself, I'm split. I can see merits in both solutions. Least code bloat
would probably be to just apply my patch. But I think we should think
mostly about style (where I am still split).
Best regards,
Mikael
>
> Have a nice day,
> Tomas Volf
>
> --
> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.
>
[-- Attachment #2: Type: text/html, Size: 4190 bytes --]
next prev parent reply other threads:[~2024-11-22 12:28 UTC|newest]
Thread overview: 10+ 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 [this message]
2024-11-22 12:20 ` janneke
2024-11-22 12:29 ` Mikael Djurfeldt
2024-11-22 23:04 ` 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='CAA2XvwLaFJAzR+=iFZpBrXRw=oMDnwnqwM3=0Oc6FBq5ZQExPw@mail.gmail.com' \
--to=mikael@djurfeldt.com \
--cc=guile-devel@gnu.org \
--cc=guile-user@gnu.org \
--cc=janneke@gnu.org \
--cc=ludo@gnu.org \
--cc=wingo@pobox.com \
/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).