---------- Forwarded message ----------
From: Colin Jones <trptco...@gmail.com>
Date: 2 May 2013 04:35
Subject: Re: Bug in reader or repl? reading keyword :#abc
To: daves...@gmail.com




On Wednesday, May 1, 2013 9:22:43 AM UTC-5, Dave Sann wrote:
>
> I came across the following...
>
> ;; => ok;
> (let [v :abc] nil)
>
> ;; => ok;
> (let [v :abc]
>    nil)
>
> ;; => ok;
> (let [v :#abc]  nil)
>
> ;; => fail;
> (let [v :#abc]
>   nil)
>
>
> $ lein repl
> nREPL server started on port 33719
> REPL-y 0.1.10
> Clojure 1.5.1
>    ...
>
> user=> ;; => ok;
>
> user=> (let [v :abc] nil)
> nil
> user=>
>
> user=> ;; => ok;
>
> user=> (let [v :abc]
>   #_=>    nil)
> nil
> user=>
>
> user=> ;; => ok;
>
> user=> (let [v :#abc]  nil)
> nil
> user=>
>
> user=>
>
> user=> ;; => fail;
>
> user=> (let [v :#abc]
> RuntimeException EOF while reading, starting at line 1  clojure.lang.Util.
> **runtimeException (Util.java:219)
>
> user=>   nil)
> nil
> RuntimeException Unmatched delimiter: )  clojure.lang.Util.**runtimeException
> (Util.java:219)
>
>
This is a symptom of how REPLy handles "unexpected" nodes that sjacket
provides (and sjacket saying that :#abc is not a keyword). REPLy started to
use sjacket for parsing input forms in 0.1.0 (final; not the betas), to
handle situations like reader literals and read-eval that require the full
execution context (which therefore need to execute remotely via nREPL).

If there's an unexpected node, REPLy throws up its hands and ships the
input off to nREPL. This appears to work fine when the input is complete,
I'd expect due to coincidence in the reader's implementation. I agree with
Ambrose; it's not promised to be a valid symbol or keyword by any
documentation I can find. Another hint is https://github.com/edn-format/edn,
where there's more specification of what characters a valid symbol/keyword
can contain:

##### from EDN spec
Symbols begin with a non-numeric character and can contain alphanumeric
characters and . * + ! - _ ? $ % & =. If -, + or . are the first character,
the second character must be non-numeric. Additionally, : # are allowed as
constituent characters in symbols other than as the first character.
#####

So I think sjacket is doing the correct thing in this situation by saying
the input is unexpected/incorrect, and that this input working in the
reader itself is not by design.

Note that this problem does not exist where the keyword in question is :a#bc

user=> (let [v :a#bc]
  #_=> v)
:a#bc


- Colin






> user=>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to