Allowing explicit :line metadata to pass unharmed

82 views
Skip to first unread message

Chas Emerick

unread,
Sep 29, 2012, 8:14:47 PM9/29/12
to cloju...@googlegroups.com
I've filed a new issue, CLJ-1079:

http://dev.clojure.org/jira/browse/CLJ-1079

In short, this changes the reader slightly to ensure that explicit :line metadata in loaded code is used in preference to line numbers provided by a LineNumberingPushbackReader, if one is being used. More details and context are in the issue description, but here's a quick REPL demonstration illustrating the problem:

=> (meta (read (clojure.lang.LineNumberingPushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 1}

...this is in contrast to the (correct, IMO) behaviour when one does not use a LineNumberingPushbackReader (this is essentially what read-string does):

=> (meta (read (java.io.PushbackReader.
(java.io.StringReader. "^{:line 66} ()"))))
{:line 66}

The patch attached to the issue is minor IMO, but I wanted to open a thread here as well; I seem to remember this being a topic at some point in the past, but I couldn't find that discussion.

Cheers,

- Chas

Chas Emerick

unread,
Oct 5, 2012, 10:28:02 AM10/5/12
to cloju...@googlegroups.com
The recent addition of :column metadata to the reader and such (great addition, BTW!) made it so the patch for this no longer applied cleanly.

I've since tweaked the patch to make it apply, and extended the treatment of :line metadata to :column as well:

http://dev.clojure.org/jira/browse/CLJ-1079

I'd love to get this screened, if anyone has a minute today.

Thanks,

- Chas

Chas Emerick

unread,
Dec 7, 2012, 11:43:43 AM12/7/12
to cloju...@googlegroups.com
Bump: http://dev.clojure.org/jira/browse/CLJ-1079 :-P

The screening and application of the patch there would make life quite a bit easier when attempting to write portable Clojure/ClojureScript using the best tools that exist currently. (The patch still applies cleanly as of this morning.) I responded to Stu H's last comment on the ticket, and would love to get this to the next step (even if that's a further dialogue).

Cheers,

- Chas
> --
> You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
> To post to this group, send email to cloju...@googlegroups.com.
> To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.
>

Reply all
Reply to author
Forward
0 new messages