guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to globally replace core binding?


From: Tomas Volf
Subject: How to globally replace core binding?
Date: Sun, 26 Nov 2023 18:42:44 +0100

Hello,

I would like to replace a core binding.  I know that I can define a module like
this:

    (define-module (foo))
    (define-public (copy-file a b)
      (display "TODO: implement file copy\n"))

And I can later use it

    scheme@(guile-user)> ,use (foo)
    scheme@(guile-user)> (copy-file 'a 'b)
    TODO: implement file copy

But!  I would like to replace the copy-file globally, for all modules, without
the need to explicitly import it.  I guess I want something in the spirit of the
`install-suspendable-ports!', so that I could do something like:

    scheme@(guile-user)> ,use (foo)
    scheme@(guile-user)> (install-better-copy-file!)

I could patch the Guile itself, but I would strongly prefer to avoid that, for
obvious reasons.  So, is it possible to achieve what I want, and if so, how?

Thank you and have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]