[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Raw" string literals for elisp
From: |
Anna Glasgall |
Subject: |
Re: "Raw" string literals for elisp |
Date: |
Wed, 08 Sep 2021 10:31:26 -0400 |
User-agent: |
Evolution 3.40.0-1 |
On Wed, 2021-09-08 at 09:10 -0400, Stefan Monnier wrote:
> > I've long been annoyed by the number of backslashes needed when
> > using
> > string literals in elisp for certain things (regexes, UNC paths,
> > etc),
>
> I most other discussions around this in the past, regexps were the
> only
> significant cases. I don't know what you have in mind behind the
> "etc.", but as for UNC: how often od you use them in ELisp and do you
> really need backslashes there (I thought slashes work almost as well
> in
> most of Windows)?
>
Cards on the table here: yes, regexes are 99.999% of the motivation
here :) UNC paths were a somewhat contrived example.
During the course of working on this, I came across the following in I
think syntax.el:
(while (re-search-forward
"\\(\\\\\\\\\\)\\(?:\\(\\\\\\\\\\)\\|\\((\\(?:\\?[0-
9]*:\\)?\\|[|)]\\)\\)" bound t)
which I feel by itself rather justifies this work.
> And AFAIC adding raw strings just to halve the number of backslashes
> in
> regexps seems both too much and too little: you'd likely prefer a new
> regexp syntax which doesn't require backslashes for grouping
> and alternation.
>
I would be _thrilled_ to have that, but that seemed like it'd be even
_more_ work than this is already ballooning into. And it does seem to
me that raw-literal syntax is something that'd be generally useful even
outside the use case of regexes.
>
> Stefan "not a big fan of raw strings in ELisp"
>
thanks,
Anna
- Re: "Raw" string literals for elisp, (continued)
- Re: "Raw" string literals for elisp, Lars Ingebrigtsen, 2021/09/08
- Re: "Raw" string literals for elisp, Alan Mackenzie, 2021/09/08
- Re: "Raw" string literals for elisp, Adam Porter, 2021/09/08
- Re: "Raw" string literals for elisp, Stefan Monnier, 2021/09/08
- 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