Clojure

GC Issue 10: remove all #=()s from non-dup prints

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Reported by richhickey, Dec 17, 2008
Need to audit and fix

Comment 1 by richhickey, Dec 17, 2008
(No comment was entered for this change.)
Owner: ---
Comment 2 by chouser, Jan 09, 2009
Currently:

user=> (java.util.HashMap. {:a 1})
#=(java.util.HashMap. {:a 1})

What's the desired output?  Perhaps the unreadable:

#<java.util.HashMap. {:a 1}>

Comment 3 by richhickey, Jan 10, 2009
Yes, the unreadable form is good
Comment 4 by chouser, Jan 10, 2009
All occurrences of #= are in RT.java and core_print.clj.

In core_print.clj, all occurrences of #= are in print-dup methods,
except for one occurrence in the print-ctor function.  print-ctor is
in turn used only in print-dup methods, except for 3 print-method's
for Java set, map, and collection types.  The attached patch removes
those print-method's, causing the default method to be used, which
generates informative output for humans but which is not readable by
LispReader.

In RT.java, #= is generated by the print() method when
PRINT_INITIALIZED is unbound or false, for Class and Var objects.
Changing these to print non-dup style output makes the Clojure compile
process throw exceptions, so I'm guess these need to stay the way they
are.

For the record, these outputs can be tested at the REPL like this:

(defmacro pre-init [x]
  `(binding [clojure.core/print-initialized false]
    (clojure.lang.RT/print ~x *out*)
    (println)))

user=> (pre-init Integer)
#=java.lang.Integer
nil
user=> (pre-init #'filter)
#=(var clojure.core/filter)
nil

--The janitor
 remove-hash-equals.patch
1.7 KB Download
Comment 5 by richhickey, Jan 14, 2009
Patch applied, svn 1209 - thanks!
Status: Fixed

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: