Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-31 Thread Yongming Shen
I have done some further digging. Looks like it is non-trivial to remove the top-level-bind-scope and still preserve the current behaviors of top-level `define-values` and `define-syntaxes`. In particular, through `as-expand-time-top-level-bindings` in "expander/expand/bind-top.rkt", both top-l

Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Yongming Shen
Hi Matthew, Thanks for the explanations. But I'm still not convinced that the top-level-bind-scope is needed. This is my current understanding. The purpose of the top-level-bind-scope is to support recursion better at the top level. But for the case of `(define-values (x) ...)`, if `x` is not

Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Alexis King
> On Mar 23, 2020, at 13:46, George Neuner wrote: > > 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.,

Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Matthew Flatt
At Mon, 23 Mar 2020 01:45:40 -0700 (PDT), Yongming Shen wrote: > I tried the example you gave for my first question and it resulted in an > error. Oops --- you're right. I lost track of what we try to make work at the top level. > I think this is because `(define-values (x) ...)` expands `...` w

Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-23 Thread Yongming Shen
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): ; applicatio

Re: [racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-21 Thread Matthew Flatt
At Sat, 21 Mar 2020 00:00:07 -0700 (PDT), Yongming Shen wrote: > First, in the source file expander/expand/bind-top.rkt, there is a comment > that says "When compiling `(define-values (x) ...)` at the top level, > we'd like to bind `x` so that a reference in the "..." will point back to > the de

[racket-users] questions about top-level-bind-scope in root-expand-context

2020-03-21 Thread Yongming Shen
Hi, I noticed that top level (define-values ...) forms create bindings that include the top-level-bind-scope (of the namespace's root-expand-context), and have two questions related to this. First, in the source file expander/expand/bind-top.rkt, there is a comment that says "When compiling `(