[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Raw" string literals for elisp
From: |
tomas |
Subject: |
Re: "Raw" string literals for elisp |
Date: |
Thu, 9 Sep 2021 09:04:31 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Sep 08, 2021 at 04:18:23PM -0400, Stefan Monnier wrote:
> > I just think these are two separate dimensions which happen to align
> > in the "regexp and backslash" case.
>
> BTW, they can align in somewhat funny ways sometimes.
> E.g. the raw-string version of the regexp "[ \t\n]" turns into something like
>
> #r"[
> ]"
Actually I was using "align" in a rather metaphorical sense, but you
are making a very good point: one might want to have some ot the
"classical C escapes" (\n, \r and some of its ilk, perhaps even \b),
but then `raw' wouldn't be raw anymore.
> which is not ideal in terms of clarity. Similarly a regexp that matches
> the NUL character will be problematic when written as a raw string
> because it will need to embed the NUL character in the source code,
> which in turn will cause tools like `grep` to treat the file as binary.
>
> For the first problem above we can/should extend our regexp syntax to
> include \t and \n as regexps that match TAB and LF respectively (that
> would also be handy when writing regexps in the minibuffer).
For regexps proper there's an escape hatch, since there is a language "on
top" that could be extended a bit (e.g. via the [:...:] character class
notation or something). But that would be unwieldy indeed.
> But \0 is already used for other things so there's no such "obvious"
> workaround for the second case :-(
Yes, the very handy `\x' notation has much history. Hard to move whithin
that cupboard without breaking anything :-)
Cheers
- t
signature.asc
Description: Digital signature
- Re: "Raw" string literals for elisp, (continued)
- Re: "Raw" string literals for elisp, Philip Kaludercic, 2021/09/08
- Re: "Raw" string literals for elisp, Alan Mackenzie, 2021/09/08
- Re: "Raw" string literals for elisp, Stefan Kangas, 2021/09/08
- Re: "Raw" string literals for elisp, Philip Kaludercic, 2021/09/08
- Re: "Raw" string literals for elisp, tomas, 2021/09/09
- Re: "Raw" string literals for elisp, Stefan Kangas, 2021/09/08
- Re: "Raw" string literals for elisp, tomas, 2021/09/08
- Re: "Raw" string literals for elisp, Lars Ingebrigtsen, 2021/09/08
- Re: "Raw" string literals for elisp, Stefan Monnier, 2021/09/08
- Re: "Raw" string literals for elisp, Stefan Monnier, 2021/09/08
- Re: "Raw" string literals for elisp,
tomas <=
- Re: "Raw" string literals for elisp, Mattias Engdegård, 2021/09/09
- Re: "Raw" string literals for elisp, Stefan Kangas, 2021/09/09
- Re: "Raw" string literals for elisp, Mattias Engdegård, 2021/09/09
- Re: "Raw" string literals for elisp, tomas, 2021/09/09
- Re: "Raw" string literals for elisp, Augusto Stoffel, 2021/09/14
- Re: "Raw" string literals for elisp, Ihor Radchenko, 2021/09/14
- Re: "Raw" string literals for elisp, Stefan Monnier, 2021/09/14
- Re: "Raw" string literals for elisp, Stefan Kangas, 2021/09/14
- Re: "Raw" string literals for elisp, Ihor Radchenko, 2021/09/14
- Re: "Raw" string literals for elisp, Clément Pit-Claudel, 2021/09/14