Simple Namespace Question

3 views
Skip to first unread message

Chris Bunch

unread,
Nov 13, 2008, 2:20:31 PM11/13/08
to Clojure
Hi all,
While playing with the Clojure REPL I changed my namespace to be
"java" (since I was testing out Java interop stuff) and now when I try
any commands, I see the following:

java.lang.RuntimeException: java.lang.SecurityException: Prohibited
package name: java (NO_SOURCE_FILE:0)

Since this also comes up when I try to switch out of the java namespace
to anything else, I can't run any commands. Is there any way to fix this
problem without quitting out of the REPL and running it again?

And going forward, is this something that Clojure should guard against
(e.g., not allow)? Of course, I'm pretty new to Clojure, so please let
me know if there's something very simple I'm not seeing.

Thanks,
Chris

Stuart Halloway

unread,
Nov 13, 2008, 2:31:54 PM11/13/08
to clo...@googlegroups.com
(clojure.core/ns clojure)

or if you are on an old build I think it would be

(clojure/ns clojure)

Rich Hickey

unread,
Nov 13, 2008, 2:39:12 PM11/13/08
to Clojure


On Nov 13, 2:31 pm, Stuart Halloway <stuart.hallo...@gmail.com> wrote:
> (clojure.core/ns clojure)
>
> or if you are on an old build I think it would be
>
> (clojure/ns clojure)
>

This is coming in my book notes, I promise :), but ns should not be
used to change namespaces in the repl, only in-ns should be used.

ns is for defining namespaces, once only per namespace.

Rich

Chris Bunch

unread,
Nov 13, 2008, 2:40:41 PM11/13/08
to Clojure
Hmm, that didn't work for me. That gives the same output as before:

java=> (clojure/ns clojure)


java.lang.RuntimeException: java.lang.SecurityException: Prohibited
package name: java (NO_SOURCE_FILE:0)

The only way I can get the REPL to return a different message is in the
case of syntax errors or calling classes that don't exist (here I'm on
the old build):

java=> (clojure.core/ns clojure)
java.lang.ClassNotFoundException: clojure.core (NO_SOURCE_FILE:98)

Any other ideas?

Stuart Halloway wrote:
> (clojure.core/ns clojure)
>
> or if you are on an old build I think it would be
>
> (clojure/ns clojure)
>
>

--

Chris Bunch
PhD Student
University of California, Santa Barbara

c...@cs.ucsb.edu

Chris Bunch

unread,
Nov 13, 2008, 2:46:31 PM11/13/08
to Clojure
Ah, I see. Thanks guys!
-- 

Chris Bunch
PhD Student
University of California, Santa Barbara

c...@cs.ucsb.edu

Meikel Brandmeyer

unread,
Nov 13, 2008, 3:58:54 PM11/13/08
to clo...@googlegroups.com
Hi,

Am 13.11.2008 um 20:40 schrieb Chris Bunch:
> Hmm, that didn't work for me. That gives the same output as before:

http://groups.google.com/group/clojure/browse_thread/thread/1b47e5c7598f1375/8f69db0a0a7e0564?lnk=gst&q=java+prohibited+namespace#8f69db0a0a7e0564

See also this thread.

Sincerely
Meikel

Michael Wood

unread,
Nov 14, 2008, 1:05:32 AM11/14/08
to clo...@googlegroups.com

It works in r1098:

user=> (in-ns 'java)
#<Namespace java>
java=> (clojure.core/in-ns 'user)
#<Namespace user>
user=> (in-ns 'java)
#<Namespace java>
java=> (in-ns 'user)
#<Namespace user>

--
Michael Wood <esio...@gmail.com>

Reply all
Reply to author
Forward
0 new messages