[racket-users] Re: Any good way to shadow a required module?
On Tuesday, May 2, 2017 at 1:04:13 PM UTC+8, Matthew Butterick wrote: > On Monday, May 1, 2017 at 9:55:10 PM UTC-7, Jinzhou Zhang wrote: > > Thus my question is: is there any good way to shadow a required module? > > `subtract-in` > > http://docs.racket-lang.org/reference/require.html?q=subtract-in#%28form._%28%28lib._racket%2Frequire..rkt%29._subtract-in%29%29 Thank you very much! Can't believe I missed it. -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Any good way to shadow a required module?
I'm creating my own language axe: http://docs.racket-lang.org/axe/index.html which aimed at providing a "good default" for myself. Now I am trying to include Alexis's data/collection as defaults. Thus I need to: ``` (require racket) (require data/collection) (provide (all-from-out racket)) (provide (all-from-out data/collection)) ``` However, `data/collection` overwrites several identifies from racket/list, such as map, first, second, etc. That makes `(require data/collection)` fail. I've tried the following: ``` (module for-export racket (require data/collection) (provide (all-defined-out))) (provide (all-from-out 'for-export)) ``` But it seems that `(all-defined-out)` will only export the manually defined identifiers in module. Thus my question is: is there any good way to shadow a required module? I don't think it is good to exclude the identifiers manually. Because any later change in data/collection (shadow another identifier) will break my package. Best Regards, Jinzhou Zhang -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: How to make unit test for error "unbound identifier"?
Sorry for forgot to mention Racket version. It is 6.8. -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] How to make unit test for error "unbound identifier"?
Hi there, I am writing a simple macro `if-let` that tried to bind the condition to a variable. ``` (define-simple-macro (if-let (~describe "binding pairs" [binding:expr value:expr]) (~describe "\"then\" clause" then:expr) (~describe "\"else\" clause" else:expr)) (let ([val value]) (if val (match-let ([binding val]) then) else))) ``` I finished the macro and start to write unit tests for it. Then I realized that the "binding" should not working in "else" statement. That means: ``` (if-let [it #f] 'true it ; <- should report "unbound identifier". ) ``` However when I tried the following code: ``` (check-exn exn:fail? (lambda () (if-let [it #f] (fail "if-let: wrong-branch") it))) ``` It gives error: ``` it: unbound identifier in module ``` So the question is how to catch the "unbound identifier" exception for unit test? Thanks! -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.