unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: guile-user@gnu.org, Tomas Volf <wolf@wolfsden.cz>
Subject: Re: How to globally replace core binding?
Date: Tue, 28 Nov 2023 01:51:46 +0100	[thread overview]
Message-ID: <90c7afb7-9bfd-30f1-c83e-3458067b69f6@telenet.be> (raw)
In-Reply-To: <ZWODlBbqtbuGqtyy@ws>


[-- Attachment #1.1.1: Type: text/plain, Size: 1016 bytes --]

(set! copy-file improved-copy-file)

This replacement 100% functioning assumes no inlining, nobody capturing 
the old copy-file on the top-level, nobody calling the C function 
directly ...

If the original copy-file is implemented in Scheme, then to avoid 
inlining problems, the module defining copy-file should do

(set! copy-file copy-file).

That way, Guile's compiler/optimizer knows that the binding is mutable 
and should not inlined (well, Guile being Guile, every binding is 
mutable, but now it is mutable from the perspective of the inliner too).

Depending on whether 'copy-file' is just a stand-in for something else 
and depending on how the better copy-file works/how it is ‘better’, it 
might be better to eventually write a patch to replace copy-file with 
the improved better-file, as then the improved copy-file is more widely 
available. (As a long-term thing; for short-term ‘trying things out’, 
doing set! is much more practical.)

Best regards,
Maxime Devos.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2023-11-28  0:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 17:42 How to globally replace core binding? Tomas Volf
2023-11-28  0:51 ` Maxime Devos [this message]
2023-11-28  1:37   ` Tomas Volf
2023-11-28  1:57     ` Maxime Devos

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=90c7afb7-9bfd-30f1-c83e-3458067b69f6@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guile-user@gnu.org \
    --cc=wolf@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).