You got me thinking that all the stuff I and you were talking about
concerning namespace dependency graph, etc. for only reloading the
appropriate namespaces should be possible to be run from the running REPL,
and thus provided as a regular tool to be available to all environments:
REPL, any IDE / back-end server etc.

In its "pure" form it could recompute the dependency graph of the namespaces
every time "on-the-fly".

With this function, even from the REPL could you be sure that you have all
the functions depending on the macros of some modified namespace up-to-date.
It is even possible to solve the "functions should be removed if no more in
the namespace" issue, by adding temporary watchers to the namespace vars,
and then removing all the vars whose watchers were not triggered and are not
defonce vars (this defonce issue being the last problem I currently see: how
to know that defonce vars have been removed ? The only solution I
temporarily envision is to rebind the defonce macro during the reload with a
decorator which will store information about defonced vars).

Of course, some corner cases will still exist: direct access to vars in
other namespaces via other-ns/the-var while not explicitly requiring/using
other-ns (maybe "oddly" relying on other-ns to be loaded preliminary, by
other means).

2010/7/19 Meikel Brandmeyer <m...@kotka.de>

> Hi,
>
> Am 19.07.2010 um 22:20 schrieb Peter Schuller:
>
> >> I haven't tested what happens to the deftest stuff, but the „moving
> function“ could be addressed.
> >
> > Cool. I had not yet run into the moving function case with clojure (I
> > did several times with Common Lisp), so that might be a non-issue. I
> > was just presuming that no magic was going on.
>
> It turns out you shouldn't also listen to me. I think I will stop writing
> emails for today. I got caught by the last-var-wins feature.
>
> Clojure 1.2.0-master-SNAPSHOT
> user=> (require 'foo.bar)
> nil
> user=> (foo.bar/baz)
> 5
> ; Remove function baz here from file
> user=> (require :reload 'foo.bar)
> nil
> user=> (foo.bar/baz)
> 5
>
> In my stupidity I chose prn as function name, which removed from the
> namespace on reload, because clojure.core/prn „overwrites“ the Var again.
> Maybe such a functionality could be also implemented for normal reload? But
> then what happens to other namespaces which refer to this Var? I admit, this
> is not a trivial question.
>
> Sincerely
> Meikel
>
> --
> 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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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