From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: `apply-partially` and hash tables Date: Sun, 20 Oct 2024 11:43:15 +0200 Message-ID: <861q0b2jpo.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19949"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 20 11:43:52 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1t2STW-00052N-Mm for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 20 Oct 2024 11:43:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2ST7-0005Z3-KM; Sun, 20 Oct 2024 05:43:25 -0400 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 ) id 1t2ST5-0005Ym-I0 for help-gnu-emacs@gnu.org; Sun, 20 Oct 2024 05:43:24 -0400 Original-Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2ST3-0008EZ-QH for help-gnu-emacs@gnu.org; Sun, 20 Oct 2024 05:43:23 -0400 Original-Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9F3DD1140128 for ; Sun, 20 Oct 2024 05:43:18 -0400 (EDT) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sun, 20 Oct 2024 05:43:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1729417398; x=1729503798; bh=vVwnYgYhIPzk+oyzPajsCHYM7FJjSK4+ 9ibC14AwI8g=; b=d/LE0moe5Iwkr5z1RUVuvi4PbwDTw0nl/3t2Q4VSFjRuy7Ot 0BwdjC9LdrxNYNiXnJo/Mo4fwYVsjuSmBbgVRE2c11B+mk0osCqFjpdqo/WTu0Xz vg8Pmt3CKp0Y2aZi0oEvkF6oZhFEDf8QWvTmjI8vJwz8ptIlVqVb5JhLXZakowod xa+wFuOs7PYrfAyJTC4zdiBQyF75hEZcmaF1HJpsxGnMA5bP8Msi3wOkT7O4ZpPI Yd7gjBUmQZodKM+l87gc4st+lSa7dgbwd0lSZtljoLYFC6yrzKhxPMH0itfYKOc8 xXalrPvYhVFk+ET5wOFoxB/q24FH2Om4xZ1BCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1729417398; x=1729503798; bh=vVwnYgYhIPzk+oyzPajsCHYM7FJjSK4+9ib C14AwI8g=; b=lq0HQWl3mjvgWr35sJWd4eFwqdaLUeREL6QcVb06bAbEn2uoX5v W5bg5C0uUukfFY+ZM967Mnq16zNSo58uW9vuqTNTi4VxYhiavebfptIOj+U36DdR yUuV5sVydYNgfJ22I0Sp/FFodagnJxOuQ6S9yn+GobMdODgr2H9P7qDviZqzv3Zr XDBV/cWLIRXhLGsvow8Md2pzKJASRbSKccptqqHMlQXPvmUILxuXIzOAa3PCheck nVFybXNJPfjkYfY4AFV/swvmDKGVwrau0ooGfMib8JFWf2TfAjgCYcw4atx+lRHy //AJwU6UcAniW1NI9HtJgxMmrws5Il0XiUg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehjedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkgggtsehttdertddttddtnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhho ohhsthhkrhgvmhgvrhhssehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpe duleekudefudfhfeekgfettddugfevkeevgfeggefgjeefudduteehleekjeelveenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkh hrvghmvghrshesfhgrshhtmhgrihhlrdhfmhdpnhgspghrtghpthhtohepuddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohephhgvlhhpqdhgnhhuqdgvmhgrtghssehgnhhurd horhhg X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 20 Oct 2024 05:43:17 -0400 (EDT) Received-SPF: pass client-ip=103.168.172.158; envelope-from=joostkremers@fastmail.fm; helo=fhigh-a7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148187 Archived-At: Hi list, A question that just came up: if I use `apply-partially` to create a function that has a hash table as one of its fixed arguments, and then at some later point add data to said hash table, it seems that this data is visible to subsequent calls to the partially applied function: ``` (let* ((s #s(hash-table test equal data ("MGrt" "Mouton De Gruyter" "OTS" "Utrecht School of Linguistics UiL-OTS"))) (fn (apply-partially #'parsebib--expand-strings s))) (puthash "BW" "Oxford: Blackwell Publishers" s) (funcall fn "BW")) "Oxford: Blackwell Publishers" ``` `parsebib--expand-strings` is a function that (among other things) does a hash table look-up. The entry ("BW" "Oxford: Blackwell Publishers") is added to the hash table after the function is created, but it can obviously still be found by it. So my question: is this intended behaviour, something that I can rely on to continue to work, or is this an artefact of the implementation that may change at any time in the future? TIA -- Joost Kremers Life has its moments