In a clean repl, try the following...

(use 'clojure.test)
(is (do (intern 'user 'bob2 2) bob2))
(is (do (def bob3 3) bob3))

The first is form breaks with a "Unable to resolve symbol" error 
at the compilation stage. The second one, on the other hand is quite
happy.

Now, I guess what is happening is this. At the compilation stage,
clojure has identified that

(def bob3 3)

happens before

bob3

so, everything is fine. But the same is not happening with the intern
statement. But surely it should be? After all

(intern 'user 'bob3 3)
bob3

is perfectly happy.

I want to use intern because I can do stuff like

(let [nm "bob4"
      vl 4]
  (intern 'user (symbol nm) vl))

which is harder to do with def.

Any advice?

Phil
     

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to