Frank:

I am pretty sure that the intent is that strings like 077 are read as
octal, and in Clojure 1.8.0 this is what happens, e.g. (read-string "077")
evaluates to the integer 63 (decimal), not 77.  Thus it is intentional that
(read-string "08") and (read-string "09") throw exceptions.

Andy

On Tue, Apr 26, 2016 at 8:51 PM, Frank Pursel <frank.pur...@gmail.com>
wrote:

> I believe the following line should replace the current 1.8.0
> jvm/clojure/lang/LispReader.java line 68:
>
> static Pattern intPat =
>         Pattern.compile(
>
> "([-+]?)(?:(0)|(0*[1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|([0-7]{3})|([1-9][0-9]?)[rR]([0-9A-Za-z]+)|0[0-9]+)(N)?");
>
>
> Without this change the 1.8.0 clojure reader fails on some simple things
> like:
>
> (read-string "08")
> (read-string "09")
>
> I see that the prior commit was trying to get old style octal identifiers
> to work (and this change doesn't get this right either) but octal can still
> be correctly read using the radix notation, eg (read-string "8r45") works.
>
> Perhaps someone here can get this change or a more sophisticated fix
> committed that will allow numeric strings with leading zeros to be
> successfully read.
>
> Regards,
> Frank Pursel
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to