Details
-
Type:
Defect
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: Release 1.4, Release 1.5
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
Environment:clojure 1.5 beta2, Mac OS X 10.8.2, java version "1.6.0_37"
Description
If a data-reader returns nil, the reader throws java.lang.RuntimeException: No dispatch macro... The error message implies that there is no dispatch macro for whatever the first character of the tag happens to be.
Here's a simple example:
(binding [*data-readers* {'f/ignore (constantly nil)}] (read-string "#f/ignore 42 10"))
RuntimeException No dispatch macro for: f clojure.lang.Util.runtimeException (Util.java:219)
Activity
Steve Miner
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch [ 11773 ] |
Steve Miner
made changes -
| Labels | reader | patch reader |
Steve Miner
made changes -
| Patch | Code and Test [ 10002 ] |
Steve Miner
made changes -
| Attachment | clj-1138-data-reader-return-nil-for-no-op.patch [ 11774 ] |
Steve Miner
made changes -
| Attachment | clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch [ 11773 ] |
Steve Miner
made changes -
| Attachment | clj-1138-data-reader-return-nil-for-no-op.patch [ 11774 ] |
Steve Miner
made changes -
| Patch | Code and Test [ 10002 ] |
Steve Miner
made changes -
| Labels | patch reader | reader |
clj-1138-allow-data-reader-to-return-nil-instead-of-throwing.patch allows a data-reader to return nil instead of throwing. Does sanity check that possible tag or record isJavaIdentifierStart(). Gives better error message for special characters that might actually be dispatch macros (rather than assuming it's a tagged literal).