On Sun, Sep 4, 2011 at 1:20 PM, Timothy Washington <twash...@gmail.com> wrote:
> I was hacking away at this at the meantime. I defined 'remove' functions in
> 2 other places - bkell , commands. I ended up renaming commands/remove to
> commands/removek, and now all invocations are working. But I'm pretty sure
> I'm using namespace and require erroneously. Currently, I have a source file
> structure like below:
> src/
>    bkell.clj
> src/commands/
>    add.clj
>    remove.clj
>    etc...
>
> But each of the 'src/commands/' clojure files, uses the '(ns command ...)'
> namespace, not '(ns command.remove ...)', etc. I wanted to do it this way,
> so that client code could just call command/remove, not
> command.remove/remove. But I'm realising that I should instead define (ns
> commands) once, and use (in-ns) in other locations. You can see the source
> here. Looks like 'get' can be redefined in two other namespaces: bkell ,
> commands. But when I try to do that for 'remove', the repl seizes up, and
> I'm curious to know why.

The require should be:

(ns bkell
  (:require commands))

and then you'll reference the functions as (commands/add ...)
(commands/remove ...) etc.

I'm not sure why (:require commands.remove) doesn't give you an
error... perhaps it was pulling in commands/remove.clj anyway?

Is there any reason why you have the commands split across multiple
files? (I'm not saying it's bad, just curious)

I suspect you're somehow calling remove recursively (but it's hard to
tell without seeing more of your code).

Sounds like you're gradually getting a handle on namespaces...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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