emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regexps and strings once again


From: Lars Magne Ingebrigtsen
Subject: Re: Regexps and strings once again
Date: Mon, 15 Sep 2014 12:04:55 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> On 09/14/2014 04:27 PM, Lars Magne Ingebrigtsen wrote:
>>> (dom-by-id dom (regexp "I \\(couldn't\\)?haz new syntax"))
>
> `regexp' could just as well take a new syntax.

Sure, it could take Perl regexps, but having the argument not be a
string would be a stretch, wouldn't it?

If we want to do a more string-ey syntax, but not require wrapping it in
(regexp ...), then we could have something like:

#r"This is (not )?a Perl regexp"

for regexp literals.  Quoting " characters would still be necessary, but
I don't think that's all that important.  (And quoting quote chars is
less annoying than quoting slashes.)

If you're constructing the regexp from strings, you'd need the `regexp'
call to turn it into a regexp object.

I kinda envision all the functions that currently have a regexp option,
or a regexp version, to also take a regexp object, no matter how it's
defined.  Like `search-forward'/`re-search-forward'...

And this could be done gradually once we've introduced the regexp object
type, so it doesn't seem like an insurmountable change, if somebody
wanted to work on this...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]