[racket-dev] Missing pregexp syntax in Racket

From: Sae Hiraku (pcxunlimited at gmail.com)
Date: Tue Nov 29 10:53:18 EST 2011

> I'm curious what others think so I'll try to find the irc
conversation.

http://racket-lang.org/irc-logs/20111126.txt
http://racket-lang.org/irc-logs/20111127.txt
http://racket-lang.org/irc-logs/20111128.txt

Search for "regexp"


> But my first impression is that such a new #px reader syntax
> should translate into the existing pregexp syntax, not extend it.  It
> seems odd to me that #px/\n/ would mean #px"\\n" and that that would
be
> equivalent to #px"\n".

I'm inclined to agree, but eli mentioned that we should tackle the
semantics
problem separate from the syntax problem... I, personally, am fine with
having
#px/\n/ be translated into #px"\n". What's important to me is that the
syntax
that is presented to the user is short and easy to use (e.g. not an
excess
amount of backslashes).


> Were you thinking likewise that #rx/\n/ would translate to #rx"\\n"?
> That can't be changed to mean the same as #rx"\n" because #rx"\\n"
already
> means the same as #rx"n", and presumably we don't want to change the
meaning
> of existing valid patterns.

*Ideally* yes, but it's not a requirement. I understand that breaking
existing
uses of #rx"\\n" is bad, so I'm okay with the idea extending only to
pregexps.



Posted on the dev mailing list.