On Tue, Jul 21, 2009 at 3:17 PM, Laurent PETIT<laurent.pe...@gmail.com> wrote:
> Hi,
>
> so far my examples were more based on issues with namespaces separated into
> multiple pieces than on a namespace / script dichotomy.
>
> So while I understand the interest of separating source files to be
> delivered to production from test files, I don't see how this would solve
> both problems I reported ? (unless in your source directory you stick to the
> one namespace / one file rule).

Yes, I absolutely stick to that rule. Files are cheap, use lots!

>
> Regards,
>
> --
> Laurent
>
> 2009/7/21 Howard Lewis Ship <hls...@gmail.com>
>>
>> The other way of looking at these issues is that this style of
>> compilation will *catch* these problematic issues. It seems to me that
>> you should divide src/main/clojure into multiple source folders with
>> an explicit ordering (say src/main/clojure and
>> src/main/clojure-scripts) to distinguish between the cases, but have
>> not explicit care of compilation order within a particular folder.
>>
>> In that case, you may need to use the snippet multiple times, one for
>> each compilation step.  Or just compile your namespaces and don't
>> compile your scripts.
>>
>> In my situation, I have tests and scripts under src/test/clojure,
>> which is not compiled.
>>
>> Again, I think if you have these kinds of issues, you may be setting
>> yourself up for some pain that's better to face before the project
>> gets too big. Often this kind of pain is solved by separating out
>> sources not by language type but by additionally by usage pattern.
>>
>> On Tue, Jul 21, 2009 at 8:43 AM, Laurent PETIT<laurent.pe...@gmail.com>
>> wrote:
>> > Hi Howard,
>> >
>> > Thanks for sharing that.
>> >
>> > One point though : I have a mitigate feeling with compiling all
>> > namespaces
>> > from the same JVM/Clojure environment. I understand that it makes the
>> > compilation go fast since ant does not need to relaunch the Compiler in
>> > a
>> > new jvm for each namespace, but I can see problems not detected by this,
>> > that could be detected if each namespace is compiled separately:
>> >
>> >  * if namespace A fails to include the appropriate :require directive
>> > for
>> > namespace B, but B is compiled before A, then A will compile OK because
>> > B
>> > has been loaded as a side effect of being compiled (this being a good or
>> > bad
>> > thing is another problem, for the current problem, let's just it be a
>> > fact).
>> > But if in your app A is loaded/required before B, clabamgo! you have a
>> > problem. This kind of problem generally always appears late in the
>> > process
>> > (generally in pre-production environments or -hopefully- via continuous
>> > integration if it includes integration tests).
>> >
>> >  * As I understand the way your script works (and I don't think it could
>> > do
>> > a better job due to the current naming convention that doesn't help
>> > distinguish files creating namespaces from files that are just scripts
>> > or
>> > pieces of namespaces), even files that are just pieces of namespaces
>> > (which
>> > I presume should contain some (in-ns) directive at their top) are passed
>> > to
>> > the compiler. For those file that will appear in the list before the
>> > file
>> > containing the namespace definition, it will result in a fail of the
>> > compilation, but they will be compiled again later, when the real file
>> > containing the namespace definition is compiled. BUT again, this could
>> > result in compilation of "dead code not yet removed from the code base
>> > for
>> > some reason", and subtle problems in integration. To be more concrete:
>> > namespace N is made of file N.clj, which includes the (ns) directive,
>> > loading files N1.clj and N2.clj as pieces of namespace N. But an old
>> > file
>> > N3.clj is still there, and (Moore's law) N3.clj redefines some functions
>> > in
>> > N2.clj. In your development box : no problem, you always load namespace
>> > N
>> > from N.clj, and N3.clj has been correctly removed from the (ns)
>> > directive.
>> > But then you compile the project for distribution .... and N3.clj is
>> > compiled after N2.clj and redefines some functions of N2.clj .... whoops
>> > !
>> >
>> > Regards,
>> >
>> > --
>> > Laurent
>> >
>> > 2009/7/21 Howard Lewis Ship <hls...@gmail.com>
>> >>
>> >> I've written an Ant build script snippet that locates .clj files and
>> >> compiles them.  Not tested on Windows.
>> >>
>> >> http://gist.github.com/151387
>> >>
>> >>
>> >> --
>> >> Howard M. Lewis Ship
>> >>
>> >> Creator of Apache Tapestry
>> >> Director of Open Source Technology at Formos
>> >>
>> >>
>> >
>> >
>> >
>> > >
>> >
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>> Director of Open Source Technology at Formos
>>
>>
>
>
>
>
> >
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry
Director of Open Source Technology at Formos

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