Skip to content

Commit

Permalink
blind: add *alias-map*
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronsa committed Dec 29, 2012
1 parent 282fced commit e74817c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -40,6 +40,8 @@ There are small differences from clojure's LispReader.java:

`blind.reader/read` is capable of reading literal tags contaning periods, fixing #CLJ-1100

`blind.reader/read` checks if `blind.reader/*alias-map*` is bound, if that's the case, aliases will be resolved by querying it (must be a map), otherwhise (ns-aliases *ns*) will be used

`blind.reader/read-line` has an additional arity with which is possible to specify the reader to read from

## License
Expand Down
4 changes: 3 additions & 1 deletion src/blind/reader.clj
Expand Up @@ -505,8 +505,10 @@
(symbol (p 0) (p 1)))
(reader-error rdr "Invalid token: " token)))))

(def ^:dynamic *alias-map* nil)
(defn- resolve-ns [sym]
(or ((ns-aliases *ns*) sym)
(or ((or *alias-map*
(ns-aliases *ns*)) sym)
(find-ns sym)))

(defn read-keyword
Expand Down

0 comments on commit e74817c

Please sign in to comment.