On Sep 10, 2008, at 7:43 AM, Rich Hickey wrote:

> If you don't want to wait, submit a patch (and a CA if you haven't
> already), and I'll look at it. I will say that the "silent ignore"
> path is not an option - cyclic dependencies are an error you can't
> leave in place. There will be other tools that need the dependencies
> to be acyclic.

The enclosed patch modifies "load" to detect and prevent loading a  
resource while another load of the same resource is pending in the  
same thread. It works at the "load" level using paths so the  
protection is comprehensive across load, require, use and ns. It  
supports using ":verbose" to see what's going on.

Here's a simple example:

        cyclic.clj:

        (ns cyclic
         (:use cyclic))

        user=> (require 'cyclic :verbose)
        (clojure/load "/cyclic/cyclic.clj")
        (clojure/load "/cyclic/cyclic.clj")
        java.lang.Exception: cannot load '/cyclic/cyclic.clj' again while it  
is loading
        [...]


And an example where mutual.a :uses mutual.b, mutual.b :uses mutual.c,  
and mutual.c :uses mutual.a

        user=> (require 'mutual.a :verbose)
        (clojure/load "/mutual/a/a.clj")
        (clojure/load "/mutual/b/b.clj")
        (clojure/load "/mutual/c/c.clj")
        (clojure/load "/mutual/a/a.clj")
        java.lang.Exception: cannot load '/mutual/a/a.clj' again while it is  
loading
        [...]

--Steve


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

Attachment: pending-paths.patch
Description: Binary data



Reply via email to