From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Dmitry Gutov <dmitry@gutov.dev>
Newsgroups: gmane.emacs.devel
Subject: Re: Turning completion table lambdas into symbols
Date: Wed, 29 Nov 2023 01:51:12 +0200
Message-ID: <36fa158d-e063-683f-38b8-27d2e1312e52@gutov.dev>
References: <87bkd3z9bi.fsf@catern.com> <87il5xlf9b.fsf@catern.com>
 <86y1esuajx.fsf@mail.linkov.net> <ierleas4fcr.fsf@janestreet.com>
 <86v89ws5t3.fsf@mail.linkov.net> <iercyw445tu.fsf@janestreet.com>
 <86v89vzf1o.fsf@mail.linkov.net> <87pm03jn3w.fsf@catern.com>
 <861qcjw3ch.fsf@mail.linkov.net> <ier1qcin8db.fsf@janestreet.com>
 <86r0ki2on3.fsf@mail.linkov.net> <ierttpdlqe4.fsf@janestreet.com>
 <86leao519y.fsf@mail.linkov.net> <87fs0wk5oq.fsf@catern.com>
 <86edgfin4v.fsf@mail.linkov.net> <87o7fhixzv.fsf@catern.com>
 <86o7fhy9ae.fsf@mail.linkov.net> <87v89ohc6f.fsf@catern.com>
 <86il5nhdvh.fsf@mail.linkov.net> <87plzuuend.fsf@catern.com>
 <86wmu1j2hh.fsf@mail.linkov.net> <87a5qxv4bh.fsf@catern.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="15653"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.13.0
Cc: Spencer Baugh <sbaugh@janestreet.com>, emacs-devel@gnu.org
To: Spencer Baugh <sbaugh@catern.com>, Juri Linkov <juri@linkov.net>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 29 00:52:17 2023
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
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 <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1r87sE-0003rF-KY
	for ged-emacs-devel@m.gmane-mx.org; Wed, 29 Nov 2023 00:52:15 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1r87rN-0007kO-Gc; Tue, 28 Nov 2023 18:51:21 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dmitry@gutov.dev>) id 1r87rL-0007jo-0d
 for emacs-devel@gnu.org; Tue, 28 Nov 2023 18:51:19 -0500
Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dmitry@gutov.dev>) id 1r87rJ-0006bw-19
 for emacs-devel@gnu.org; Tue, 28 Nov 2023 18:51:18 -0500
Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44])
 by mailout.nyi.internal (Postfix) with ESMTP id 163875C02AF;
 Tue, 28 Nov 2023 18:51:15 -0500 (EST)
Original-Received: from mailfrontend1 ([10.202.2.162])
 by compute4.internal (MEProxy); Tue, 28 Nov 2023 18:51:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc
 :cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to; s=fm3; t=
 1701215475; x=1701301875; bh=z8Q51LPwvMtNgAboZl6ADakxCgrwPbQF4HT
 B0uk6Q4Q=; b=kT0h1fAMoeVCmAmovKf6+ocxcuKuHFxyxas1Y2uP1U9uKm12a61
 q7aGfLt8qI3GR87WOKOQ2YOvlrFZg0plYZASTJHmk4XP4qT1pF4G4ZZL8+h00lPG
 imHRsLjZ3gUUiSNCEMPxC0AhynHSwly+k7TdB4WGaaOTegp+jycvOXZeKfDdd5hY
 ojGJdseIceljQ1Rb2q7z0gczxVK8Z9INcVqGV6EOXdcelIzzzGie6bcoxA/oilu4
 +pO3q2N1EFQ76UU/BPwhOHtNHvvass58E5wrHdrqQPNuzbIcfPc915uxsnBrt3+E
 PEru+vFCY9zCcARgrojl522rMdGJWUePY+g==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:sender:subject:subject:to:to:x-me-proxy
 :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=
 1701215475; x=1701301875; bh=z8Q51LPwvMtNgAboZl6ADakxCgrwPbQF4HT
 B0uk6Q4Q=; b=k2BQVGdcKcK7xXxOC8XyKzHHqbw/PbDQcfeI2KnTm2xIU1Hgcg6
 nUuzT4ZDWfTCaPVTwpNg11K5zXfDypDUn1V4M1HEVIgj+oxfQbffWcAB3NaiVz8Z
 AFeIU0/Q/ffTuNnAcoOWyNi7TyHV5JDsbBV+w5bxaOtQ+IeuDTiwbWZbXA1DYoe7
 ySP3h2LLr4z8Z8QjEeIO3bOO6bCa7krIIZsEDNoYFjv8MkoyXsZc8RQwQWRCmVzM
 74WI7EaNe+BM+HP7Ao93c1YiphxAxnlJffoTnPXIf4nB/W31cQyxp006h1WchzMI
 Rc5PPAToZLv5tr1v2aQ0GQ2BH9zy2ZMLSLQ==
X-ME-Sender: <xms:8nxmZWeW4r7ix_9PSxzCiypF1gt28Db5Xkg4Hb0whdtQ9SZ7kUmMYg>
 <xme:8nxmZQOwhBrfnuzPCBTAKNQvB365o7r8nENaxov8ER3PN3Km0U3p62nskWCKoR-4C
 O9jkQs_oKc2jz6CPpk>
X-ME-Received: <xmr:8nxmZXj7xVS01B4UpHgkmPvfWVGMK3zWhCViIloHWSS3qu6j2je0DPrcd7Xvu4kvLyu5XA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeigedgudegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi
 thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth
 htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel
 vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug
 hmihhtrhihsehguhhtohhvrdguvghv
X-ME-Proxy: <xmx:8nxmZT9OvR9ecsbxhOuSC3GfSXXtl5Qp64yBI5aLW-199VzP-Hgk_Q>
 <xmx:8nxmZSuvPph6Hb7fQiV_CCYvkiIhmnrQoUnutHqG_061xbcCYB_Yew>
 <xmx:8nxmZaHTm2pEJQVeoTHBgdI-8InuN_zftMDLnW753weg4Goj3cYAdA>
 <xmx:83xmZb5W4lFEtJWLJgXpzobb21XOzAaEy5-dBqmmL4RspyI-Qy1tng>
Feedback-ID: i0e71465a:Fastmail
Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue,
 28 Nov 2023 18:51:13 -0500 (EST)
Content-Language: en-US
In-Reply-To: <87a5qxv4bh.fsf@catern.com>
Received-SPF: pass client-ip=66.111.4.29; envelope-from=dmitry@gutov.dev;
 helo=out5-smtp.messagingengine.com
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 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, NICE_REPLY_A=-1.37,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.devel:313340
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/313340>

On 29/11/2023 01:36, Spencer Baugh wrote:
> If there was a canonical way for a completion table to maintain some
> state which*doesn't*  require the completion table to be a lambda, I
> think most completion tables could become defuns instead of lambdas.
> (And then they could be customized based on the function symbol)

Maybe take a look at how company-capf caches the results of calling a 
CAPF function?

Depending on the data, the cache key is either 
buffer/point/chars-modified-tick tuple, or the "completion session" (but 
in a company-mode specific way).

For CAPF and Company, we also discussed the idea of a "session object" 
some time ago, but that's not in the current API so far.