(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: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to