From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Add some aliases for re-related functions Date: Sun, 03 May 2020 23:11:00 -0400 Message-ID: References: <7976B8C1-AFC7-4662-B750-6492EB70C0D5@gmail.com> <1f156067-9bf3-e588-4306-9d673a2a27b9@yandex.ru> <2a5344e3-999c-bb60-3c27-a9e9e6c256da@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="98942"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Yuan Fu , Emacs developers To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 04 05:13:11 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 1jVRXa-000Pdu-0B for ged-emacs-devel@m.gmane-mx.org; Mon, 04 May 2020 05:13:10 +0200 Original-Received: from localhost ([::1]:40078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVRXZ-0005wQ-1B for ged-emacs-devel@m.gmane-mx.org; Sun, 03 May 2020 23:13:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVRVc-0002uw-AK for emacs-devel@gnu.org; Sun, 03 May 2020 23:11:08 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36246) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVRVZ-0007ER-D5 for emacs-devel@gnu.org; Sun, 03 May 2020 23:11:07 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4A3801007E4; Sun, 3 May 2020 23:11:04 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D6656100447; Sun, 3 May 2020 23:11:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1588561861; bh=YH9KvNqap6eFr+eLvOf6Dm0zSRyi7KM2f4f5q67GsL8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cE+htQkR6RXHsUv7RGqZd/3b59c3Hiriz5hthRpTBVz4EZDR/rJKvnIbj33j3N349 VQyiXBH7sAcBOHTJqSswNSWgsN/gQe5pWmUqPTVGjO9aHDaBSvuvq2mkQJ5AGQJ6xe VFzNBsZbUa0GfvwlrdhZ/Tn3l/c4nhc8p/JX6kcm8Ot67pIt0qfaUoRVuX+e4VdMrT 5ql+F5sMIlfe8M6s8OYmzI3lfmL5EzdkRnZgLtrjyVsKRDNbktFjQ22biDpwz/V9Kr h4FwU3q0961UV8+wcJPKdRyqawqdIy0TP2mPkGG4wg5vdFwsB7AH9TPFrGpPirkGRM X+bCFLmlYRx6Q== Original-Received: from alfajor (unknown [216.154.3.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 97AD8120312; Sun, 3 May 2020 23:11:01 -0400 (EDT) In-Reply-To: (Dmitry Gutov's message of "Mon, 4 May 2020 03:29:02 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/03 22:59:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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:248776 Archived-At: >> give you an automaton that can do the search or "RE" in O(n) time, but >> it won't directly give you the "leftmost longest match" (instead it can >> directly give you "the match whose match-end is closest" and "the match >> whose match-end is furthest"). > But that's what we generally want in practice anyway. Not according to POSIX and not according to the traditional behavior of Emacs's regexp search. >> Yes, it's unfortunate. Maybe we could/should merge them to clarify: >> (re-match REGEXP &optional STRING LIMIT START) >> (re-search REGEXP &optional STRING LIMIT START) >> would be like `looking-at` but would operate on STRING instead of >> `current-buffer` if STRING is non-nil. START defaults to point for >> current-buffer and 0 for a string. > re-search-forward also moves point, whereas string-match returns the index > of the match start. Oh, indeed, `re-search-forward` returns the match-end whereas `string-match` returns the match start. I hate that difference. > I'm not sure it's worth the changeover and retraining everybody Agreed. > if the main benefit is being more aware of the underlying > algorithm complexity. Not sure what this has to do with the algorithm complexity. > It suppose so. Yet, in all cases I had to rewrite looking-back calls to add > the now-mandatory argument, the resulting time it took was fast enough to > get lost in the measurement noise. Yes, the limit arg hides most of the performance problems, indeed. Stefan