On Apr 13, 2014, at 8:31 AM, Thomas Heller <[email protected]> wrote:
> [...] confusing error messages.
>
> user=> (pr-str #time/local-datetime [2014 4 1 0 0 2 99999999999])
>
> [...]
> RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException
> (Util.java:221)
Using default #inst reader gives the same behavior.
This is an artifact of how the repl currently works. Its input is a stream of
characters to which it applies the read, eval, and print operations in a loop.
There is prompt-handling code in the repl that makes it feel "turn" oriented in
most cases, but this case isn't handled. It does not currently implement "on
exception in read, flush the rest of the pending user input and re-prompt".
Here's an example with a vanilla clojure 1.6.0 (java -jar <the clojure
1.6.0.jar>) that may clarify what's going on:
user=> (println 1 2 3 #inst "4" 5 6 7 8 9)
RuntimeException Unrecognized date/time syntax: 4
clojure.instant/fn--6236/fn--6237 (instant.clj:118)
5
6
7
8
9
RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException
(Util.java:221)
The start of the list "(println 1 2 3" reads fine, then the #inst read throws
an exception. After the exception, the repl starts working on the remainder of
the input characters as if it were fresh user input. It sees integers and
prints them. When it hits ")", there's no corresponding "(" pending, so it
throws again.
--Steve
--
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.