From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Make peg.el a built-in library? Date: Fri, 01 Oct 2021 11:40:47 -0700 Message-ID: <878rzcmvv4.fsf@ericabrahamsen.net> References: <875yvtbbn3.fsf@ericabrahamsen.net> <83wno8u3uz.fsf@gnu.org> <87v93s9q4n.fsf@ericabrahamsen.net> <875yvafjr9.fsf@ericabrahamsen.net> <878rzdreem.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17074"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Adam Porter , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 01 20:42:37 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 1mWNUR-0004FU-T5 for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 20:42:35 +0200 Original-Received: from localhost ([::1]:52718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWNUQ-00071V-VX for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 14:42:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWNSu-0005cp-0S for emacs-devel@gnu.org; Fri, 01 Oct 2021 14:41:00 -0400 Original-Received: from mail.ericabrahamsen.net ([52.70.2.18]:42174) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWNSs-0002kQ-1O for emacs-devel@gnu.org; Fri, 01 Oct 2021 14:40:59 -0400 Original-Received: from localhost (c-71-197-232-156.hsd1.wa.comcast.net [71.197.232.156]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id B18DBFA024; Fri, 1 Oct 2021 18:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1633113649; bh=shAFNVtm/J+oIAAq/O7tpP5fHRrYipiwRecKR6NFXkE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=xqIjLJ/KhhdpBQ52PQ2+SEDQmWktR6o1Bk1N/lbVW4rGuxR5a+5mF8GFyKn1NKY6F 9eewA02XWfOcHplr1uLNHuCFEk0/PffLAUg+zDreq0xzbJweZqkVWa0MW80A63DIt8 6ax0g9t5FNM9m59dV5rsIPgrDQ0VvNWinpyHlK2U= In-Reply-To: (Stefan Monnier's message of "Fri, 01 Oct 2021 14:05:20 -0400") Received-SPF: pass client-ip=52.70.2.18; envelope-from=eric@ericabrahamsen.net; helo=mail.ericabrahamsen.net X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, 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:276004 Archived-At: Stefan Monnier writes: >> In org-ql, the PEX is redefined at load time and/or run time, being >> derived from search keywords that are defined by the package and >> possibly by the user. So the PEX can't be defined in advance, at >> compile time. So having to use `with-peg-rules' means having to use >> `eval'. > > If the grammar changes radically at run time, based on external/user > data there's probably no better way than via `eval` or similar (`load`, > `byte-compile`, you name it). Can you explain why a function plus some sort of pre-compilation step won't work? Maybe if I just tried to write the patch I would naturally see the problem, but theoretically I don't get it... > But if the changes are sufficiently limited (e.g. have an (or "foo" > "bar" ....) with a variable set of strings that can match), then we can > do better. > > E.g. we could have a PEX of the form (re FORM) where FORM can be any > ELisp expression that returns a regular expression. I suppose the `call' pex you mentioned up-thread could also ease things a bit. I'll hold off on the documentation patch until we know whether any code will change.