I think the best way for me to approach this is to ask what you want to do.
 This is a generalization, but most code doesn't need to call eval - the
REPL does, and some advanced uses of generating code at runtime based on
data.  The normal Lisp approach for code that generates code is macros
(defmacro, not eval), so you might want to look into that first:
http://clojure.org/macros.

I see the repl in main.clj does something similar to you in its
with-bindings, but the reason is to make those vars able to be set!, not to
establish the external namespace for the eval.  In your eval string, the ns
is the default 'user ns.  To use a different ns, you would need to establish
that inside the string.

I think the only difference between the REPL and the runtime you're seeing
is precisely because the REPL is an environment for eval'ing code.  There's
no interpreter, only one compiler.

Hope this helps.

-Mike

On Mon, Jun 22, 2009 at 5:38 PM, Chouser <chou...@gmail.com> wrote:

>
> On Mon, Jun 22, 2009 at 5:11 PM, Nicolas Oury<nicolas.o...@gmail.com>
> wrote:
> >
> > Of course, there is eval, but eval is not very competent in manipulating
> > namespace and bindings at runtinme.
>
> eval is exactly what the REPL uses, one call to eval per
> top-level form.  In several examples you put an 'ns' form
> and others into a single 'do' form -- you can try that at
> a REPL to see how it will work before putting it into an
> eval call.
>
> > - (binding [*ns* *ns*]
>
> I think you may be misunderstanind something about Vars or
> binding -- I can't think of a situation in which the above
> usage of 'binding' would have any purpose.  Perhaps it would
> be worth your time to review http://clojure.org/vars
>
> --Chouser
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to