<< Back to previous view

[TNS-33] Accept symbols for 'require' and 'use' inside 'ns' Created: 19/Dec/14  Updated: 19/Dec/14  Resolved: 19/Dec/14

Status: Closed
Project: tools.namespace
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Stuart Sierra Assignee: Stuart Sierra
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-TNS-33-handle-non-keyword-clause-heads-in-ns-form.patch    
Patch: Code and Test

 Description   

clojure.core.ns allows much more syntactic variation than its docstring describes.

One example is (ns foo (require bar)) where require should be the keyword :require.

As of 0.2.9, tools.namespace silently ignores these forms.



 Comments   
Comment by Stuart Sierra [ 19/Dec/14 5:44 PM ]

Accidental duplicate of TNS-32





[TNS-28] Add other Clojure suffixes to clojure.tools.namespace.file/clojure-file? Created: 25/Nov/14  Updated: 19/Dec/14  Resolved: 19/Dec/14

Status: Closed
Project: tools.namespace
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Daniel Compton Assignee: Stuart Sierra
Resolution: Duplicate Votes: 0
Labels: None


 Description   

It would be handy to use clojure.tools.namespace.file's clojure-file? function for Clojure files other than vanilla JVM Clojure. I had to copy clojure-file https://github.com/jonase/kibit/blob/master/src/kibit/driver.clj#L17-L22 to be able to let it handle cljs, cljx, and other types of Clojure files. Is it possible to add other extensions to clojure-file? or make a new extended-clojure-file? (or similar name), so that people can reuse the common tooling available in clojure.tools.namespace?

I'm happy to put together a patch for whichever direction you'd prefer, making a new function, or extending the existing one (perhaps by adding a new arity with a clj-only? parameter to not break existing code).



 Comments   
Comment by Stuart Sierra [ 19/Dec/14 5:44 PM ]

Duplicate of TNS-5





[TNS-31] Better error reporting for incorrect :after parameter of refresh Created: 08/Dec/14  Updated: 19/Dec/14  Resolved: 19/Dec/14

Status: Closed
Project: tools.namespace
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Petr Gladkikh Assignee: Stuart Sierra
Resolution: Completed Votes: 0
Labels: None


 Description   

clojure.tools.namespace.repl/refresh accepts symbol as named parameter :after. If this symbol cannot be resolved then this causes NullPointerException which is not helpful.
NullPointerException's stack trace:

java.lang.NullPointerException: null
repl.clj:99 clojure.tools.namespace.repl/do-refresh
repl.clj:142 clojure.tools.namespace.repl/refresh

It would be nice to verify result of 'resolve' and throw IllegalArgumentException with appropriate message. The change would be:

--- a/src/main/clojure/clojure/tools/namespace/repl.clj
+++ b/src/main/clojure/clojure/tools/namespace/repl.clj
@@ -96,7 +96,9 @@
     (let [result (print-and-return refresh-tracker)]
       (if (= :ok result)
         (if after-sym
-          ((ns-resolve *ns* after-sym))
+          (if-let [after-fn (ns-resolve *ns* after-sym)]
+            (after-fn)
+            (throw (IllegalArgumentException. (str "Cannot resolve 'after' function " after-sym))))
           result)
         ;; There was an error, recover as much as we can:
         (do (when-not (or (false? (::unload (meta *ns*)))

Used tools.namespace version 0.2.7



 Comments   
Comment by Stuart Sierra [ 19/Dec/14 3:48 PM ]

Fix included in release 0.2.8





Generated at Mon Dec 22 19:40:47 CST 2014 using JIRA 4.4#649-r158309.