Clojure

(keyword "@type") can be printed, but not read

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: Release 1.2
  • Fix Version/s: Backlog
  • Component/s: None
  • Labels:
    None
  • Approval:
    Incomplete

Description

user=> (keyword "")
:
user=> (prn-str *1)
":\n"
user=> (read-string *1)
java.lang.RuntimeException: java.lang.Exception: Invalid token: : (NO_SOURCE_FILE:0)

This obviously isn't a huge defect, but I'd argue that anything that can be printed should be readable.

Activity

Hide
David Smith added a comment -

This is a clone of http://dev.clojure.org/jira/browse/CLJ-732 which it appears was closed with no explanation. I have recently come up against this when deserializing json. IMO it doesn't make sense for the keyword function to be able to produce non-valid keywords. What is the reason for rejecting this?

Show
David Smith added a comment - This is a clone of http://dev.clojure.org/jira/browse/CLJ-732 which it appears was closed with no explanation. I have recently come up against this when deserializing json. IMO it doesn't make sense for the keyword function to be able to produce non-valid keywords. What is the reason for rejecting this?
Hide
Alex Miller added a comment -

This is a feature used by a lot of Clojure programs. See:

http://clojure.org/guides/faq#unreadable_keywords

Show
Alex Miller added a comment - This is a feature used by a lot of Clojure programs. See: http://clojure.org/guides/faq#unreadable_keywords
Hide
David Smith added a comment -

Thank you for the explanation, this can therefor be closed.

Show
David Smith added a comment - Thank you for the explanation, this can therefor be closed.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: