Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Looking into this, you mean using (use 'mynamespace :reload) instead of C-c C-k - that is a good idea!

It should be trivial to write a ring middleware to reload everything between every request (for a railsy development environment) maybe a version for production use that checks all files for changes every 1 minute or so.



I think it's a touch trickier than that. As far as I'm aware, a reload cannot remove namespace mappings; it can just add new ones and overwrite existing ones. So with continual reloads you might find yourself with old deprecated functions cluttering up your namespace.

Another problem is that Clojure loads up namespaces sequentially, rather than atomically. So you might end up with an a new version of one function calling the old version of another.

In order for your reloading middleware to be robust, I suspect you'd have to (1) wait for any existing request-handling threads to finish, (2) suspend any new request-handling threads, (3) reload your namespaces, (4) resume any suspended request threads.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: