On 9 jan, 16:11, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > My recommendation would be to not write scripts at all. Instead, write > a "-main" function for your namespace and launch your application at > the Java command line in the usual way. In general, I think > distributed libraries should never have top-level side effects.
I quite agree with you. At least, this would be easier for me to design the "auto-build" part of clojure-ide, I think ... But currently, it is just "best practices" given to clojure users. So there is still the possibility that a user emits a top level "(System/ exit 0)" somewhere in his file. This instruction would then kill the clojure environment dedicated to compilation / namespace search / documentation finding / ... I don't think there is a solution to this problem, currently. Or maybe I should think of a totally different way of doing things. Or maybe a semi-automatic way of doing things (as seems to be the case in emacs/slime, where the user can (from what I've understood) specify a list of files to be loaded everytime on clojure environment startup, and where the user must manually call compile/load on the files he modifies. > > -Stuart Sierra > > On Jan 9, 2:00 am, lpetit <laurent.pe...@gmail.com> wrote: > > > On 9 jan, 07:54, lpetit <laurent.pe...@gmail.com> wrote: > > > > On 9 jan, 04:03, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > > > > > Later on, if I call (load) (from a fresh clojure environment) from the > > > > > compiled classes, the top level (println)s are not executed, since not > > > > > compiled. > > > > > Yes, that's the expected behavior. "compile" only saves the things > > > > defined in the namespace. > > > > Well, I easily understand that it is the compiled behaviour. And in > > > the same time, I don't feel it "right" that loading the same lib from > > > source file or from compiled files can have different results. > > > Because then, it's not correct to say that we can interchange a source > > version and a compiled version of a lib. > > So maybe it should be expressed that libs should not do anything but > > define things in the namespace (maybe it's also stated in the doc and > > I skipped it, if so, my apologies). > > -> And that could be a distinction between libs and plain namespaces. > > And in that case, do you think it could be interesting to mark the > > namespace with a "is-a-lib" meta-data to (for example) : > > - prevent the compiler to compile it by default (or emit a warning, or > > compile only if some :force flag is set) > > - allow automatic tools to explicitly see the difference between a lib > > and a PON (plain old namespace) > > > Thanks in advance for your answers, > > > -- > > Laurent --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---