Re: [racket-dev] [racket] lab notebook on learning process (was: Re: Macros baffle me)

2014-05-07 Thread Jens Axel Søgaard
2014-05-06 23:48 GMT+02:00 Stephen Chang stch...@ccs.neu.edu: How about an extra button, a Run Benchmark button? You can already get this with the benchmark package, from pkg.racket-lang. A builtin button will hopefully make it obvious even for non-DrRacket users, that Run is not intended for

[racket-dev] A strange problem with namespaces

2014-05-07 Thread Sam Tobin-Hochstadt
This program: https://gist.github.com/samth/e7b55fcef66da9b8416a works when line 33 is uncommented, otherwise it gives the error: ?: module mismatch; attempted to use a module that is not available possible cause: using (dynamic-require #f) but need (dynamic-require 0)

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Robby Findler
When I look at this code I can't figure out why (submod weird.rkt evaluator) _isn't_ available at phase 0! Could this be a bug? Robby On Wed, May 7, 2014 at 9:11 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: This program: https://gist.github.com/samth/e7b55fcef66da9b8416a works when line

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Sam Tobin-Hochstadt
Well, to quote from the docs for `dynamic-require`: When provided is a symbol, the value of the module’s export with the given name is returned, and still the module is not visited or made available in higher phases. That's why I think the extra line is needed. You're right that the error

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Robby Findler
Yes, I've read those docs many times. :) I'll also note that changing the require in 'f' to this doesn't help, which seems suspicious: (require (submod .. evaluator) (for-meta 0 (submod .. evaluator)) (for-meta 1 (submod .. evaluator)) (for-meta 2 (submod ..

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Matthew Flatt
I think the right change might be (module evaluator racket (define (prep!) (parameterize ([current-namespace namespace]) (dynamic-require (variable-reference-module-path-index (#%variable-reference)) 0)))

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Robby Findler
Oh! So the evaluator module is available in phase 0 in 'ns', but not in 'namespace'. Is that right? Robby On Wed, May 7, 2014 at 9:58 AM, Matthew Flatt mfl...@cs.utah.edu wrote: I think the right change might be (module evaluator racket (define (prep!) (parameterize

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Matthew Flatt
No, the `evaluator` module wasn't available anywhere. I'll work on the definition of available in the docs. Available at phase 0 implies that you can use macros that are bound at phase 0 and whose implementations live at phase 1. At Wed, 7 May 2014 10:03:25 -0500, Robby Findler wrote: Oh! So

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Matthew Flatt
Adding an option to `namespace-anchor-empty-namespace` makes sense. I'm not sure that it should be the default behavior, and so I lean toward keeping the default behavior the same as it is. At Wed, 7 May 2014 11:07:32 -0400, Sam Tobin-Hochstadt wrote: Great, thanks! Is there a reason that

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Sam Tobin-Hochstadt
On Wed, May 7, 2014 at 11:07 AM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Great, thanks! Also, can you say more about when this trick is needed? When I try to use it in the actual code that I want to run, I end up with the same error, or about other submodules that are missing. More

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Matthew Flatt
I see. The errors are about the modules that require evaluator.rkt. That is, the modules that use `phase1-phase0-eval` need to be available, not just evaluator.rkt, so that transformer bindings in those modules can be used. So, (define (prep! varref) (define p

Re: [racket-dev] A strange problem with namespaces

2014-05-07 Thread Sam Tobin-Hochstadt
On Wed, May 7, 2014 at 11:57 AM, Matthew Flatt mfl...@cs.utah.edu wrote: I see. The errors are about the modules that require evaluator.rkt. That is, the modules that use `phase1-phase0-eval` need to be available, not just evaluator.rkt, so that transformer bindings in those modules can be