On Aug 31, 8:12 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote:
> One of the downsides of interactive development and testing using the
> REPL is the fact that an old definitions in a lib's namespace can
> linger in memory after its source code has been deleted from the lib.
> One can relaunch Clojure to be sure of clearing that situation, but
> that often loses some desirable context. I'm proposing a change to
> make relaunching Clojure for that purpose unnecessary.
>
> With the new clojure/require and clojure/use, we've introduced a
> suggested, preferred, best-supported way of working with Clojure in
> which there's a one-to-one correspondence between a lib namespace and
> the lib that defines it. The enclosed patch would ensure that any old
> definitions in a lib namespace are discarded before loading the lib:
> the namespace would be built up from scratch with each load. Putting
> the 'remove-ns call at the location I suggest would allow ":reload"
> and ":reload-all" to support this "from scratch" behavior as well.
> (:reload-all is especially useful from the REPL.)
>
> There may still be situations where other code can hold onto an old
> definition across a reload but this change will cover the vast
> majority of cases easily and reliably.
>
> Would this be a good change?
>
No, because code that used the namespace will then be bound to
orphaned vars. New/fixed definitions under those names will create new
vars, and thus not update referencing code.
So, only namespaces that are not referenced by anything else can be
safely removed - it's a very special-purpose operation.
Rich
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---