From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vasilij Schneidermann Newsgroups: gmane.emacs.devel Subject: Re: Make regexp handling more regular Date: Thu, 3 Dec 2020 23:20:30 +0100 Message-ID: <20201203222030.GG1196@odonien.localdomain> References: <87lfeg60iy.fsf@gnus.org> <87a6uv7vp1.fsf@mail.linkov.net> <87360nz3gl.fsf@gnus.org> <87wnxya9il.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Uu2n37VG4rOBDVuR" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14287"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , Stefan Monnier , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 03 23:22:16 2020 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 1kkwzO-0003Zd-LC for ged-emacs-devel@m.gmane-mx.org; Thu, 03 Dec 2020 23:22:14 +0100 Original-Received: from localhost ([::1]:53030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkwzN-0002HT-JC for ged-emacs-devel@m.gmane-mx.org; Thu, 03 Dec 2020 17:22:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkwxs-0001fS-EK for emacs-devel@gnu.org; Thu, 03 Dec 2020 17:20:40 -0500 Original-Received: from mout-p-201.mailbox.org ([2001:67c:2050::465:201]:18500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1kkwxq-000689-3M for emacs-devel@gnu.org; Thu, 03 Dec 2020 17:20:39 -0500 Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Cn9Jf5wfMzQjhF; Thu, 3 Dec 2020 23:20:34 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id DgEMlGRUcwy0; Thu, 3 Dec 2020 23:20:31 +0100 (CET) Mail-Followup-To: Juri Linkov , Stefan Monnier , Lars Ingebrigtsen , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <87wnxya9il.fsf@mail.linkov.net> X-Rspamd-Score: -4.62 / 15.00 / 15.00 X-Rspamd-Queue-Id: B03851723 X-Rspamd-UID: 2539ec Received-SPF: pass client-ip=2001:67c:2050::465:201; envelope-from=mail@vasilij.de; helo=mout-p-201.mailbox.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:260257 Archived-At: --Uu2n37VG4rOBDVuR Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Notably in Ruby e.g. /(.)(.)(.)/.match("foo") returns a MatchData object: >=20 > # >=20 > Shouldn't a function like string-match (or rather some new function) > return a # object too? Or the current list returned > by the function 'match-data' is sufficient? Personally I find the pattern of mixing a check for a match object, then access to the global match variables a lot more convenient in Ruby than extracting the data from the match object: 'foo123bar'[/[a-z]+([0-9]+)[a-z]+/] && $1 #=3D> "123" The alternative: m =3D /[a-z]+([0-9]+)[a-z]+/.match('foo123bar') m && m[1] #=3D> "123" The above is more attractive if there was an if-let/when-let equivalent. So that's what I'd design against. --Uu2n37VG4rOBDVuR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEE0dAcySl3bqM8O17WFmfJg6zCifoFAl/JZKUACgkQFmfJg6zC ifrQnAf8CMHvuQGWKghmBtNgUf1f48zXyZAI/6Qpp7q95VZvk6aFk2Ku+vc6OSjZ WRY+iY3DwJeq5tu30MUE4psdrhjzO6ZQCme7LB5Z0Rd916oFlxY5jrlhUIDsGlX1 Wxs24ddG85X3joLzq/ec6GjgFcGkI0xHhP4AdZI9Q8iVng0gCpYHYltAQI1j6Geq DgRDVWM81iVOQSJ27p0V4uyXpvK5HI/8LwVnqi+afxUXBMaCybMjnSdqQPHSGQFF iB47/BwLop1lN4wHn7qkt54eME7DOjW0pIIRDX1NJlgMGqmTacZK7dKG4WK8dkaL dN0s0BIKsCVK82lwE8hFEPwyhMte2Q== =AsFK -----END PGP SIGNATURE----- --Uu2n37VG4rOBDVuR--