Hi all,
I have an issue with references to closed over references outside the go
block not resolving types. The first function resolves fine. The second
one cannot resolve (.readLine buf-reader)
(defn parser-process-good
"Consumes lines from a file, transforms entries of interest and puts them on
a channel"
[^String file pred xform out-channel]
(let [buf-reader (BufferedReader. (FileReader. file))]
(async/go-loop [^BufferedReader reader buf-reader]
(when-let [line (.readLine reader)]
(do
(if (pred line) (async/>!! out-channel (xform line)))
(recur reader))
))
))
(defn parser-process-bad
"Consumes lines from a file, transforms entries of interest and puts them on
a channel"
[^String file pred xform out-channel]
(let [buf-reader ^BufferedReader (BufferedReader. (FileReader. file))]
(async/go-loop []
(when-let [line (.readLine buf-reader)] ;reference to field or no args
method call readLine cannot be resolved
(do
(if (pred line) (async/>!! out-channel (xform line)))
(recur))
))
))
The closed Jira item I found was ASYNC-28, but it was closed as not
reproducible. I'm getting this using 0.1.346.0-17112a-alpha.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.