static-rename compiles down to something totally different, actually. It uses the 'inferred-name <https://docs.racket-lang.org/reference/syntax-model.html#%28idx._%28gentag._2._%28lib._scribblings%2Freference%2Freference..scrbl%29%29%29> syntax property to get the Racket compiler to choose a different name for the function at compile time. This is different from `(procedure-rename do-something 'do-i)`, which creates a wrapper function around the original. The 'inferred-name approach is guaranteed to have no runtime overhead.
On Tuesday, October 12, 2021 at 12:25:15 PM UTC-7 [email protected] wrote: > Okay, good. Thanks for the library recommendation; I'll probably use that > in the future where I need to rename/provide multiple things, but given > that there's only one I did this instead in order to avoid having another > dependency: > > (provide do-it) > (define do-it (procedure-rename do-something 'do-i)) > > I suspect I'm reinventing the wheel and that's what static-rename compiles > down to. > > > On Tue, Oct 12, 2021 at 3:14 PM 'William J. Bowman' via Racket Users < > [email protected]> wrote: > >> I think this is the expected behaviour of `rename-out`; you might want >> this library to change the dynamic displayed name: >> https://docs.racket-lang.org/static-rename/index.html >> >> -- >> William J. Bowman >> >> On Tue, Oct 12, 2021 at 03:07:13PM -0400, David Storrs wrote: >> > --------------- >> > ; test.rkt >> > #lang racket >> > (define (do-something) "ok") >> > (provide do-something) >> > >> > ; test2.rkt >> > #lang racket >> > (require "test.rkt") >> > (provide (rename-out [do-something do-it])) >> > >> > #lang racket >> > (require "test2.rkt") >> > do-it >> > --------------- >> > >> > The printed value is #<procedure:do-something> although I was expecting >> > #<procedure:do-it>. Have I done something wrong or simply misunderstood >> > how rename-out works? >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups "Racket Users" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/racket-users/CAE8gKodiRBWPK5MfgYnOi_V%2B%3DwwFzBxtQK1qV2Mj-zPuHEXn9g%40mail.gmail.com >> . >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/racket-users/YWXekUFzaEkaitiB%40williamjbowman.com >> . >> > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/0dc52c9c-0b8a-462b-94a3-0f126809469dn%40googlegroups.com.

