Re: [racket-users] provide-if-not-defined

2020-09-03 Thread Shriram Krishnamurthi
Thank you both. What I want is something closer to what Oak wrote, but that addresses only *checking*, whereas I also want the convenience of defining the module. So to use Oak's example, I want to be able to write #lang racket/base (provide-if-not-defined + - *) at the top of *all

Re: [racket-users] provide-if-not-defined

2020-09-02 Thread Sorawee Porncharoenwase
IIUC, that’s not what Shriram wants. He wants a kind of interface / contract for a module (that it must export certain identifiers). The solution that you posted makes the module satisfy the interface by construction, but it creates another problem which is that he might accidentally export a

Re: [racket-users] provide-if-not-defined

2020-09-02 Thread Michael MacLeod
Does this example work: http://pasterack.org/pastes/95923? `if-not-defined` is written as a provide transformer which uses `syntax-local-module-defined-identifiers` to get the list of phase-0 identifiers defined in the module. Best, Michael [code also pasted below]: #lang racket/base (module

[racket-users] provide-if-not-defined

2020-09-02 Thread Shriram Krishnamurthi
Related to my previous post [ https://groups.google.com/g/racket-users/c/OqyqDFxwhf0], I have several cases where I have this kind of pattern: V1: #lang racket (provide +) V2: #lang racket (provide [rename-out (my-+ +)]) (define my-+ …) Each variant provides some/all primitives directly from