#"" reader syntax interacts badly with quoting

1 view
Skip to first unread message

Darshan Shaligram

unread,
Mar 14, 2008, 4:14:24 AM3/14/08
to clo...@googlegroups.com
The #"" reader macro breaks quoted forms:

user=> '(. #"c" (matcher "c"))
(. c (matcher "c"))

user=> `(. #"c" (matcher "c"))
(. c (user/matcher "c"))

I believe #"x" should expand into (. java.util.regex.Pattern (compile
"x")) instead of compiling the pattern in the reader itself.

Cheers,
Darshan

Darshan Shaligram

unread,
Mar 14, 2008, 4:16:47 AM3/14/08
to clo...@googlegroups.com
On Fri, Mar 14, 2008 at 1:44 PM, Darshan Shaligram <scin...@gmail.com> wrote:
> The #"" reader macro breaks quoted forms:
> user=> '(. #"c" (matcher "c"))
> (. c (matcher "c"))
[...]

> I believe #"x" should expand into (. java.util.regex.Pattern (compile
> "x")) instead of compiling the pattern in the reader itself.

Or alternatively, of course, Patterns should get the printer roundtrip
treatment.

Cheers,
Darshan

Rich Hickey

unread,
Mar 14, 2008, 8:33:19 AM3/14/08
to Clojure


On Mar 14, 4:16 am, "Darshan Shaligram" <scinti...@gmail.com> wrote:
> On Fri, Mar 14, 2008 at 1:44 PM, Darshan Shaligram <scinti...@gmail.com> wrote:
> > The #"" reader macro breaks quoted forms:
> > user=> '(. #"c" (matcher "c"))
> > (. c (matcher "c"))
> [...]
> > I believe #"x" should expand into (. java.util.regex.Pattern (compile
> > "x")) instead of compiling the pattern in the reader itself.
>
> Or alternatively, of course, Patterns should get the printer roundtrip
> treatment.
>

Not compiling in the reader would substantially reduce their utility.
This really is a printing thing - has nothing to do with quote:

user=> #"c"
c

Things that aren't specially handled by the printer print their
toString representation. We've been discussing a modification to the
#"..." syntax. When I implement that change I'll add regex print
support.

Rich
Reply all
Reply to author
Forward
0 new messages