Fork me on GitHub
#clojure-dev
<
2021-12-21
>
souenzzo00:12:27

(clojure.repl/doc *in*)
-------------------------
clojure.core/*in*
  A java.io.Reader object representing standard input for read operations.

  Defaults to System/in, wrapped in a LineNumberingPushbackReader
=> nil
(clojure.repl/source read-line)
(defn read-line
  "Reads the next line from stream that is the current value of *in* ."
  {:added "1.0"
   :static true}
  []
  (if (instance? clojure.lang.LineNumberingPushbackReader *in*)
    (.readLine ^clojure.lang.LineNumberingPushbackReader *in*)
    (.readLine ^java.io.BufferedReader *in*)))
=> nil
The doc of *in* say that it should be a Reader But read-line assumes that *in* is a BufferedReader Reader do not have .readLine method.

Alex Miller (Clojure team)00:12:12

I agree that seems inconsistent

Alex Miller (Clojure team)00:12:55

there's a bit of dynamic type weirdness here that LineNumberingPushbackReader and BufferedReader both have .readLine, but not through any common interface

Alex Miller (Clojure team)00:12:44

I think really the expectation is "Reader and has .readLine method"