On Fri, Feb 13, 2009 at 10:18 AM, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> 2009/2/13 Mark Volkmann <r.mark.volkm...@gmail.com>
>>
>> On Thu, Feb 12, 2009 at 5:09 PM, Laurent PETIT <laurent.pe...@gmail.com>
>> wrote:
>> > In a nutshell (not tested, but nothing should miss, just typos if it
>> > doesn't
>> > work) :
>> >
>> > mkdir test-compile
>> > cd test-compile
>> > mkdir classes
>> > mkdir src
>> > mkdir src/echo
>> > echo "(ns echo.test) (defn echo [msg] msg)" > src/echo/test.clj
>> > java -cp path/to/clojure.jar:src/:classes/ clojure.lang.Repl
>> > user> (compile 'echo.test)
>> > echo.test
>> > user> (echo.test/echo "ECHHHOOOO!!!")
>> > ECHHHOOOO!!!
>> > user>
>> >
>> > A classical error is to forget to put the classes/ folder in the
>> > classpath.
>> > This folder (as defined by default by the global var *compile-path*) is
>> > where clojure generates the class files, and where it the immediately
>> > tries
>> > to load them from : so it must be on the classpath.
>>
>> The steps above work for me.
>>
>> What if I have several source files with the namespace "echo.test"?
>> Where do I need to put those so that all of them are compiled when I
>> run (compile 'echo.test)? Do they need to be named specially? Maybe
>> what I'm trying to do isn't possible.
>
> Hello,
>
> Normally, just one of those file will have the (ns ). Others will just be
> (load)ed from the ns-defining file (the one with the (ns)), and contain just
> (in-ns 'echo.test) at their top.

Ah ... I think I've seen this before. Is it a common convention to
create a directory in the same location as the main source file with
the same name as that source file and place the additional source
files inside it? For example, you have src/echo/test.clj. Would you
create the directory src/echo/test and put additional source files
that have the same namespace in that directory?

> Then, just sending (compile 'echo.test) will compile everything.
>
> It's now that things get a little bit much complicated. Currently, if you
> just  modify a secondary file of ns echo.test , then sending (compile
> 'echo.test) will not work, because the ns-defining file has not been
> modified, and so it will not be recompiled (because recompilation of the
> secondary file of ns echo.test is a side-effect of calling 'compile on the
> ns-defining file).
>
> The current solution to this problem in clojuredev is a brute-force one :
> 'touch all files to be sure that everything gets recompiled.
>
> There is currently a discussion on providing this behaviour in a cleaner way
> by using a global var or :reload-all flag to (compile).
> Using it, you will be sure that by calling (compile 'echo.test :reload-all
> true) on a namespace/lib, all the files being part of the ns will be
> recompiled, and you will not have to use 'touch trick anymore.

Thanks for explaining that!

-- 
R. Mark Volkmann
Object Computing, Inc.

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