Re: [racket-dev] patch for make-base-eval

2013-10-03 Thread Ryan Culpepper
I'm concerned about this: +[sandbox-namespace-specs + (cons (λ () (namespace-anchor->namespace anchor)) It seems like this would cause all evaluators to share a single namespace, if I'm reading the docs right. (That would be a good test to add.) Why not

Re: [racket-dev] patch for make-base-eval

2013-10-03 Thread Stephen Chang
> Do you need to do the same thing with file/convertible? The current version only attaches file/convertible. > > Robby > > > On Thu, Oct 3, 2013 at 1:09 PM, Stephen Chang wrote: >> >> Here's another attempt at a patch. Would someone mind code reviewing it? >> >> Ryan pointed me towards sandbox

Re: [racket-dev] patch for make-base-eval

2013-10-03 Thread Robby Findler
Do you need to do the same thing with file/convertible? Robby On Thu, Oct 3, 2013 at 1:09 PM, Stephen Chang wrote: > Here's another attempt at a patch. Would someone mind code reviewing it? > > Ryan pointed me towards sandbox-namespace-specs and it seems to do the > trick. I also added some te

Re: [racket-dev] patch for make-base-eval

2013-10-03 Thread Stephen Chang
Here's another attempt at a patch. Would someone mind code reviewing it? Ryan pointed me towards sandbox-namespace-specs and it seems to do the trick. I also added some tests and the docs seem to compile ok. On Wed, Oct 2, 2013 at 7:21 PM, Robby Findler wrote: > namespace-attach-module sets up s

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Robby Findler
namespace-attach-module sets up shared state between two modules so that, in this case, the racket/pretty in one namespace is the same as the racket/pretty in the other. Try putting a printf in the top-level of racket/pretty (and in various other places in that code as it does what it does) and th

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Stephen Chang
Ok here's another dumb question. Why is that namespace-attach-module even needed? It seems the dynamic require on the next line does the desired thing? On Wed, Oct 2, 2013 at 4:16 PM, Stephen Chang wrote: > Ok thanks for the explanations. I'll try doing one of the last two > suggestions. > > On

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Stephen Chang
Ok thanks for the explanations. I'll try doing one of the last two suggestions. On Wed, Oct 2, 2013 at 4:09 PM, Ryan Culpepper wrote: > No, the 'racket/pretty' module might be declared even if the symbol isn't > defined (or "mapped") in the namespace: > > > (define ns (make-base-namespace)) >

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Ryan Culpepper
No, the 'racket/pretty' module might be declared even if the symbol isn't defined (or "mapped") in the namespace: > (define ns (make-base-namespace)) > (define repl-ns (current-namespace)) > (parameterize ((current-namespace ns)) (eval '(require (only-in racket/pretty > (parame

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Robby Findler
Right, exactly. Which is why Ryan's earlier suggestions are better: You can avoid all this mess. Robby On Wed, Oct 2, 2013 at 2:59 PM, Ryan Culpepper wrote: > Yes. Also, it's not enough to check that 'racket/pretty' (or really, the > name 'racket/pretty' resolves to) isn't declared in the tar

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Ryan Culpepper
Yes. Also, it's not enough to check that 'racket/pretty' (or really, the name 'racket/pretty' resolves to) isn't declared in the target namespace; you must also check any module it (transitively) requires is either undeclared or was attached from the same namespace you want to attach racket/pre

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Stephen Chang
> A namespace is a mapping from top-level identifiers to whatever they are, as > well as a separate mapping from module names to modules (roughly). What you > care about here is the second mapping, but you're checking the first with > the patch. Thanks for the explanation. That helps a lot. So the

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Robby Findler
A namespace is a mapping from top-level identifiers to whatever they are, as well as a separate mapping from module names to modules (roughly). What you care about here is the second mapping, but you're checking the first with the patch. Robby On Wed, Oct 2, 2013 at 2:45 PM, Stephen Chang wrote

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Stephen Chang
> Whether that identifier exists in the namespace has nothing to do with > whether racket/pretty can be attached. Can you explain this a little more because it's a little unintuitive to me? > > One option would be for install-pretty-printer! to just catch and discard > the error. Evaluators for

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Robby Findler
The last two sound better than the others to me, FWIW. Robby On Wed, Oct 2, 2013 at 2:37 PM, Ryan Culpepper wrote: > On 10/02/2013 03:19 PM, Stephen Chang wrote: > >> Can I push the attached (1-line) patch? I don't have a good grasp of >> namespaces so I would like someone to review it first.

Re: [racket-dev] patch for make-base-eval

2013-10-02 Thread Ryan Culpepper
On 10/02/2013 03:19 PM, Stephen Chang wrote: Can I push the attached (1-line) patch? I don't have a good grasp of namespaces so I would like someone to review it first. Right now, make-base-eval tries to attach racket/pretty to the namespace regardless of whether it's already there, which someti

[racket-dev] patch for make-base-eval

2013-10-02 Thread Stephen Chang
Can I push the attached (1-line) patch? I don't have a good grasp of namespaces so I would like someone to review it first. Right now, make-base-eval tries to attach racket/pretty to the namespace regardless of whether it's already there, which sometimes results in an exception (for example if the