Details
-
Type:
Defect
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
Approval:Vetted
Description
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171
Which effectively means that reader tags cannot contain periods.
The EDN spec is unclear on this:
edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag.
(issue opened: https://github.com/edn-format/edn/issues/39)
If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class.
I'm happy to write the patch if this behavior is what is desired.
Activity
Kevin Lynagh
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods. The EDN spec is unclear on this: edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag. If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods. The EDN spec is unclear on this: edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag. (issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
Kevin Lynagh
made changes -
| Description |
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods. The EDN spec is unclear on this: edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag. (issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods. The EDN spec is unclear on this: bq. edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag. (issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
Kevin Lynagh
made changes -
| Description |
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods. The EDN spec is unclear on this: bq. edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag. (issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in *data-readers* and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
The LispReader tries to read a record instead of a literal if the tag contains periods:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1171 Which effectively means that reader tags cannot contain periods. The EDN spec is unclear on this: bq. edn supports extensibility through a simple mechanism. # followed immediately by a symbol starting with an alphabetic character indicates that that symbol is a tag. (issue opened: https://github.com/edn-format/edn/issues/39) If periods are allowed, then the LispReader should first check to see if the tag is in {{\*data-readers\*}} and only then if not try to initialize a Java class. I'm happy to write the patch if this behavior is what is desired. |
Rich Hickey
made changes -
| Fix Version/s | Release 1.5 [ 10150 ] |
Rich Hickey
made changes -
| Approval | Vetted [ 10003 ] |
Kevin Lynagh
made changes -
| Patch | Code and Test [ 10002 ] | |
| Attachment | clj-1100-reader-literal-periods.patch [ 11665 ] |
Steve Miner
made changes -
| Attachment | CLJ-1100-allow-periods-in-data-reader-tags.patch [ 11666 ] |
Steve Miner
made changes -
| Attachment | CLJ-1100-allow-periods-in-data-reader-tags.patch [ 11666 ] |
Steve Miner
made changes -
| Attachment | CLJ-1100-periods-in-data-reader-tags.patch [ 11716 ] |
Rich Hickey
made changes -
| Fix Version/s | Release 1.5 [ 10150 ] |
Steve Miner
made changes -
| Attachment | CLJ-1100-periods-in-data-reader-tags.patch [ 11716 ] |
Steve Miner
made changes -
| Attachment | CLJ-1100-periods-in-data-reader-tags.patch [ 11731 ] |
Steve Miner
made changes -
| Comment | [ Allow periods in data-reader tags. Tries \*data-readers* first, then default-data-readers as usual. Then tries tag as a possible record class, and finally tries the \*default-data-reader-fn*. More flexible than assuming any tag with a period is a record class. Note, with this patch, \*data-readers* can override a record class. I'm calling that a feature. ] |
Steve Miner
made changes -
| Comment | [ Revised my patch to add more tests and be more discriminating when considering if a tag could a record class name. The previous comments still apply. ] |
Andy Fingerhut
made changes -
| Attachment | clj-1100-periods-in-data-reader-tags-patch-v2.txt [ 11842 ] |
Andy Fingerhut
made changes -
| Attachment | clj-1100-periods-in-data-reader-tags-patch-v2.txt [ 11842 ] |
Steve Miner
made changes -
| Attachment | CLJ-1100-periods-in-data-reader-tags.patch [ 11731 ] |
Steve Miner
made changes -
| Patch | Code and Test [ 10002 ] |
Kevin Lynagh
made changes -
| Attachment | clj-1100-reader-literal-periods.patch [ 11665 ] |
The suggested patch (clj-1100-reader-literal-periods.patch) will break reading records when *default-data-reader-fn* is set. Try adding a test like this: