Mike, are you referring to this:
http://groups.google.com/group/clojure/browse_thread/thread/b4704108d85693d0/84dd4b690b6d7afd?lnk=gst&q=alias#84dd4b690b6d7afd
?

Roger, I realize this invalidates your test, but if do this instead,
the error goes away:

(alias 'c 'coretest)
(testing "test alias function"
        (is (= 1
                (do
                        (c/foo true)
))))

As I understand it, the Clojure reader expects to be able to resolve
namespace references as soon as it sees them. Since "alias" is a
function, the "c" alias doesn't exist until sometime after the reader
has already run.  I think you will encounter a similar problem with
the import macro.

> I can't seem to find the explanation I once saw for this. It's
> something like: "c/foo" is resolved when the "do" form is _read_ ...
> at which point the alias hasn't happened yet.
>
> On Jan 2, 3:14 pm, Roger Gilliar <ro...@gilliar.de> wrote:
>
> > Hi !
>
> > Given the code below, I'm wondering why I get
>
> > No such namespace: c
>
> > It would be nice if some could explain to me what I'm doing wrong.
>
> > Regards
> >   Roger
>
> > (ns coretest
> >         (:use [clojure.test])
> > )
>
> > (defn foo [x]
> >         (condp = x
> >                 true 1
> >                 false 2
> >         )
> > )
>
> > (testing "test alias function"
> >         (is (= 1
> >                 (do
> >                         (alias 'c 'coretest)
> >                         (c/foo true)
> > ))))

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