From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Anna Glasgall Newsgroups: gmane.emacs.devel Subject: Re: "Raw" string literals for elisp Date: Wed, 08 Sep 2021 10:31:26 -0400 Message-ID: References: <4209edd83cfee7c84b2d75ebfcd38784fa21b23c.camel@crossproduct.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39106"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.40.0-1 Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 08 17:16:24 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mNzJI-0009uj-L6 for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Sep 2021 17:16:24 +0200 Original-Received: from localhost ([::1]:46096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNzJG-0006X6-D4 for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Sep 2021 11:16:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNybr-0005H7-Jg for emacs-devel@gnu.org; Wed, 08 Sep 2021 10:31:32 -0400 Original-Received: from singularity.crossproduct.net ([136.248.125.68]:57736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNybp-0008Jx-9Q for emacs-devel@gnu.org; Wed, 08 Sep 2021 10:31:31 -0400 Original-Received: from cryptic.home.crossproduct.net (c-71-192-162-242.hsd1.ma.comcast.net [71.192.162.242]) by singularity.crossproduct.net (Postfix) with ESMTPSA id D741D1E00DE; Wed, 8 Sep 2021 10:31:26 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=crossproduct.net; s=crossproduct; t=1631111486; bh=v809LoUXgwknzFzIcQzyggaQ+/fVLSEFEMgowToViTA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=tRJVNKHZmq52qv0AiJ2hXCcX08xfm4bWFo0ZM6OS0wqJ24B6HTSVV3xxJtibI/QHX yy3F4CurJOaO3EfriwuTEQ1v4/UIQ+lVUA0mYCGhQCJRr7TUNMY6dfCTre4PW83YFj qMhH0UEIs8qT+/Uq2L/jB8q65HGJc6moLxKDexGQ= In-Reply-To: Received-SPF: pass client-ip=136.248.125.68; envelope-from=anna@crossproduct.net; helo=singularity.crossproduct.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 08 Sep 2021 11:04:30 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274355 Archived-At: 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