weavejester / ns-tracker

Library to keep track of changes to Clojure source files
Eclipse Public License 1.0
114 stars 20 forks source link

Changes in namespaces split over several files are not detected #1

Closed alexjg closed 11 years ago

alexjg commented 12 years ago

If you use the technique mentioned here to split a namespace over multiple files, changes in the files using in-ns will not be detected by ns-tracker.

I've created a simple example project at https://github.com/alexjg/ns-tracker-multiple-files if you start a repl in that project, then change the value of dummy-var in the core/subspace.clj file ns-tracker will not pick up the change.

weavejester commented 12 years ago

ns-tracker works by parsing the namespace declaration at the top of a file; for this reason, it won't work on namespaces split across several files.

It might be possible to search a file for loads, but this can obviously never be 100% foolproof.

Generally speaking, dividing a namespace up is useful only in exceptional circumstances. May I ask why you need to split up your namespace across multiple files?

alexjg commented 12 years ago

I'm building a compojure app and I had a views namespace which I wanted to split across multiple files because the views are hiccup templates and it seemed irritatingly verbose to type things like myapp.views.viewname/viewname but equally I didn't want one massive file of hiccup templates.

I solved that by categorising the views at a slightly more granular level (eg by the resource which they represent) and based on your comment about it being rare to split namespaces I guess that's the idiomatic approach, in which case apologies for the noise.

weavejester commented 11 years ago

Fixed by #10 (with some caveats)