On Mon, 23 Mar 2020 01:45:40 -0700 (PDT), Yongming Shen <symi...@gmail.com> wrote:
>Hi Matthew, > >Thank you for the quick reply! > >I tried the example you gave for my first question and it resulted in an >error. >I have the following as `module-that-defines-fib`: > > #lang racket > (provide fib) > (define fib "fib") > >And this is the error that I got (using Racket 7.6): > > ; application: not a procedure; > ; expected a procedure that can be applied to arguments > ; given: "fib" > ; [,bt for context] I've run into this problem before ... I don't recall the official explanation, but my takeaway was that Racket does not permit you to directly *export* a value - you have to export a function or macro that produces the value. E.g., #lang racket (provide fib) (define (fib) "fib") >I think this is because `(define-values (x) ...)` expands `...` without the >top-level-bind-scope, even when expand-context-to-parsed? is #t (according >to expander/expand/top.rkt). Is this a bug? >Related to your answer to my second question, `define-syntaxes` similarly >does not add the top-level-bind-scope when expanding `...`. Does this mean >that even for `define-syntaxes`, `...` won't use the top-level-bind-scope >binding(s) after all? > >A little bit off-topic, in the definition of define-values (in >expander/expand/top.rkt), there is `(define-match m s ...)`, but for >define-syntaxes it is `(define-match m disarmed-s ...)`. Is this difference >significant? Or does define-match not care whether `s` or `disarmed-s` is >used? I don't know the internals so I can't evaluate your theory. >Thanks, >Yongming George -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/2l0i7flr0to9msl6sg165vptiec0qq26l7%404ax.com.