Skip to content

Commit

Permalink
Add an optional environment argument to #'resolve and ns-resolve. See…
Browse files Browse the repository at this point in the history
… #263

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information
cgrand authored and stuarthalloway committed Oct 15, 2010
1 parent da53848 commit 4b9d7ba
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/clj/clojure/core.clj
Expand Up @@ -3733,19 +3733,23 @@

(defn ns-resolve
"Returns the var or Class to which a symbol will be resolved in the
namespace, else nil. Note that if the symbol is fully qualified,
the var/Class to which it resolves need not be present in the
namespace."
namespace (unless found in the environement), else nil. Note that
if the symbol is fully qualified, the var/Class to which it resolves
need not be present in the namespace."
{:added "1.0"
:static true}
[ns sym]
(clojure.lang.Compiler/maybeResolveIn (the-ns ns) sym))
([ns sym]
(ns-resolve ns nil sym))
([ns env sym]
(when-not (contains? env sym)
(clojure.lang.Compiler/maybeResolveIn (the-ns ns) sym))))

(defn resolve
"same as (ns-resolve *ns* symbol)"
"same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
{:added "1.0"
:static true}
[sym] (ns-resolve *ns* sym))
([sym] (ns-resolve *ns* sym))
([env sym] (ns-resolve *ns* env sym)))

(defn array-map
"Constructs an array-map."
Expand Down

0 comments on commit 4b9d7ba

Please sign in to comment.