From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: Trimming strings, /emacs/lisp/emacs-lisp/subr-x.el modification Date: Wed, 10 May 2017 16:21:57 +0700 Message-ID: References: <87vapij1l7.fsf@holos> <6870A2B6-F685-4955-9C0A-256601DB47BC@gmail.com> <51D5E92C-F125-4ADE-8C55-E3513C00ECDC@gmail.com> <8F6958D6-3E13-4C31-B1F8-AF10A8FC8FC6@gmail.com> <838tmafigi.fsf@gnu.org> <7C79DA34-96F2-4D9F-9E9C-01574AE00F12@gmail.com> <8360hefepp.fsf@gnu.org> <0E129E02-FA64-4664-825B-8854A66CA9C6@gmail.com> <3D0BA0E6-02E2-4E90-8A59-121065547E1C@gmail.com> <87ziepho0q.fsf@gnu.org> <83vapderm3.fsf@gnu.org> <87vapdhi9j.fsf@gnu.org> <83tw4xeorf.fsf@gnu.org> <87zieo4ov7.fsf@gnu.org> <83efw0ehhu.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1494408182 22276 195.159.176.226 (10 May 2017 09:23:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 10 May 2017 09:23:02 +0000 (UTC) Cc: Mark Oteiza , jean.christophe.helary@gmail.com, Emacs developers , =?UTF-8?Q?Johan_Bockg=C3=A5rd?= , Tino Calancha To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 10 11:22:56 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8Npe-0005cD-74 for ged-emacs-devel@m.gmane.org; Wed, 10 May 2017 11:22:54 +0200 Original-Received: from localhost ([::1]:41290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8Npj-0008UQ-Qc for ged-emacs-devel@m.gmane.org; Wed, 10 May 2017 05:22:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8NpA-0008UA-6F for emacs-devel@gnu.org; Wed, 10 May 2017 05:22:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8Np9-00055A-8m for emacs-devel@gnu.org; Wed, 10 May 2017 05:22:24 -0400 Original-Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:33677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d8Np6-00053u-BP; Wed, 10 May 2017 05:22:20 -0400 Original-Received: by mail-wr0-x243.google.com with SMTP id w50so6640093wrc.0; Wed, 10 May 2017 02:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=uMbqpMX0JBguEEuZ2G+Egc1oYLdLLA6IXmkR6Gwjkak=; b=UQFy93n0km8ew/pMSl6MsuJHtuFbF4NgbZHi+Pe3u7C6oYkji1uUwk0QN5d7JBcQMI 8Z3JLr4aoJVL1lFcNQLyJ9ELeqAFuS539539CWVOqg7pV9VuZWMvz8PRqPBaUGVGuhpW M4YulBNhHCz4XG12V+2eC/v72FsVuNkdXFcDEMk9Csur4VQCfjYZu1INWxn9HZtNlUsr vl4PagYntalXMddboEcawckKTyX2RG1jjqJ8xb8GKWpcFLfUZeD9fM3B4t7MAurFMw27 7Lx0z0cl3oidN4cbfb0ONk6CewfXYhj2muJ7yfYo6UipQLmCMwJoscqUklrAfKhu6kko 2p8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=uMbqpMX0JBguEEuZ2G+Egc1oYLdLLA6IXmkR6Gwjkak=; b=PSUzfeumHF8Vz1nIpPtEHdmLQVHBHyayqJ7t3cSpCfqtINVRPullUcSkGUot6k58JK ihd3MWnyUcxbsSaV7oqDTxV3QiPziOWsCaMO9ACkb5+MoHCha25sbIBMWcRmoXs10ItL tiJWuO2ficwCWgkLpwKL0zmBEpEUfM2tpDMxvjeaX+HBSiUh0TKpH4hHzclF7yN7OdfH ZIhpzjjFGCcfyGjtl8tSUYharkAwJACq2cEYE3W7dTe47UXcW7jhRjjSdh+pCiLhJdfe dTWVGtqbHpfuTssUGGKM9sR9W1x4uqrgliPomXrGsbMfrczvaha9/BO8OaFn8huik3yu ei6A== X-Gm-Message-State: AODbwcBnsQ1LLHJF2lrsH8FpJjFw/pMs5tIxOq1Iz54DnD2GtfGleO3b Z0Sth8v6iIMJa5T1P38uTx8WBY+sqHM/ X-Received: by 10.223.160.139 with SMTP id m11mr2679214wrm.99.1494408138709; Wed, 10 May 2017 02:22:18 -0700 (PDT) Original-Received: by 10.223.163.196 with HTTP; Wed, 10 May 2017 02:21:57 -0700 (PDT) In-Reply-To: <83efw0ehhu.fsf@gnu.org> X-Google-Sender-Auth: T0-wwK-oX94RyGtFC52vaGONEbU X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214745 Archived-At: On Sun, May 7, 2017 at 11:53 PM, Eli Zaretskii wrote: >> >> >> I think regexp should be surrounded by a grouping construct, like: >> >> >> >> >> >> (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") > > I'm _asking_ whether it should be the caller's duty. The issue is not unique to regular expressions. It is a poster example for C preprocessor macros. #define TWICE(x) 2 * x vs #define TWICE(x) (2 * (x)) The top example places the duty of correctly parenthesizing the macro argument and the whole invocation on the caller. The bottom example assumes that duty itself. Pretty much every coding style guide resolves the issue in favor of the latter. Meyers=E2=80=99 razor: [Make interfaces easy to use correctly a= nd hard to use incorrectly.][1] (Also, pretty much every C++ coding style guide says =E2=80=9Cavoid preprocessor macros; use language constructs that actually care for syntax, such as functions and function templates=E2=80=9D. In Elisp, the closest although imperfect analogy would probably be (rx-to-string `(: string-start (regexp ,regexp))), which does add a non-capturing group where needed.) [1]: http://www.aristeia.com/Papers/IEEE_Software_JulAug_2004_revised.htm Now, the issue at hand is: Do we want to expose all the broken code that is using the existing interface incorrectly, or do we keep backward bug compatibility?