From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: maphash Date: Wed, 11 Sep 2024 16:23:18 +0200 Message-ID: References: <875xr3h5g9.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38463"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Andrea Corallo To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 11 16:32:58 2024 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 1soOOw-0009s4-5z for ged-emacs-devel@m.gmane-mx.org; Wed, 11 Sep 2024 16:32:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soON2-00070O-JX; Wed, 11 Sep 2024 10:31:01 -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 1soOMx-0006Xk-Lu for emacs-devel@gnu.org; Wed, 11 Sep 2024 10:30:55 -0400 Original-Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soOMv-00045o-BX; Wed, 11 Sep 2024 10:30:55 -0400 Original-Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5c25554ec1eso8866135a12.1; Wed, 11 Sep 2024 07:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726065050; x=1726669850; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=yqaO8bhrSHyeMjLLKeuiPFsgG+Y5CA40OsLwUKIOcQM=; b=MisQ1uPuJhRtwLqrqDtjpBdjKmEhzLF8oo8SzctYJhRKKlOd2uHWSyV1dPhJMLa8Zw c9jZpRGAPPeAZEySH0tJk4bNHNyZyqvDY6EEdQ2Q1/XUU+TROTHnIv22G46ZcsB8fn2w qYwCv+AqAjp/Hdk250efgjZEqb6VRlYzJiEBnDqRucgx6PdxdKQvpvHSjEnPyV3VIE/M dX49Jj7OwfZIuj0j1lvWpTDXaIl6KzcQanlh6o7/wT7tyXZ2HcR07f9KcoKWI9kCHweo 40j/bUcQ0qN6E/lTwrUmUHhfiQteGU3OSc3nhB5lcGIG6da5JK3PnMHf3tg2T/ZSK90Y NEAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726065050; x=1726669850; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yqaO8bhrSHyeMjLLKeuiPFsgG+Y5CA40OsLwUKIOcQM=; b=bTWrLo+unTw7dqDWWHw7LZNK3+H07HntJViW+0b1n13KBzaYCpp7AJJea77FKD+Se2 6p+omPsGePyS5NFKgJpsAS+q3dlvtxXU1e+sDed5xyFZR6kBa2BuwJ+MbAh2NPdqsv7k iuWZpXeoX6J7HGckrZj8DvJjiLO2qdIbOu9M+gGegNK24Ed1GdYZVtSkoJpnNoaaWhZk a74LbvESI6OipNd7B2oNVyjCT5VNLyS4DTLMbaPboVEN60f9RkmSWYDqx7XQsZgqEW/t /XNKP1TLERKCq4nS59eppj/NQeEW9c5Y23JTAWT1udONfNB6GBe1YlVzkzUEcRkAI9xH hHOw== X-Forwarded-Encrypted: i=1; AJvYcCXgDUkfRrOdREoWVmeKOZK6bTSF1p+v6zqARyzyVPZd0ROmOuqzydMMcFxOqs/rliqmDd58L5uilQ==@gnu.org X-Gm-Message-State: AOJu0YwkjNZ9+ZAVnqadaNrr9WWGSgu99ovpv08kZV0ANfY9y/iRDsVv hOGWSqBBQHnVpboeyhpv3ExDvUFZW0wlWyJoe69OqcF0tFo/g/Y1VB1KSQ== X-Google-Smtp-Source: AGHT+IHRAMEi3dzizbe97M0y7qtC6bOItAvbFuIAsBsDmARQkXhbVTehLCknlZrqaiJYHP8LivqYww== X-Received: by 2002:a05:6512:39ce:b0:530:abec:9a23 with SMTP id 2adb3069b0e04-536587b3f52mr10776598e87.17.1726064600291; Wed, 11 Sep 2024 07:23:20 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-191-82.bredband.tele2.se. [188.150.191.82]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5365f86ff14sm1586516e87.86.2024.09.11.07.23.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Sep 2024 07:23:19 -0700 (PDT) In-Reply-To: <875xr3h5g9.fsf@gmail.com> X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=mattias.engdegard@gmail.com; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323544 Archived-At: 10 sep. 2024 kl. 17.52 skrev Helmut Eller : > The documentation states that puthash and remhash are only "allowed" = to > use the current key while a maphash is in progress. (Interestingly, = it > says nothing about gethash.) That is correct. The purpose of these rules is to avoid us being = shackled to a specific behaviour if a user breaks them; we don't want = any more implementation restrictions than necessary. We still protect Lisp abstractions so the user shouldn't fear segfaults, = but there are no promises when it comes to the iteration order, whether = iteration will encounter added elements, the same element twice or some = none at all, etc. > However, the code in comp.el uses puthash with other keys. E.g > comp--add-cond-cstrs-simple iterates over a hashtable of basic blocks > and while the iteration is in progress, it calls > comp--add-cond-cstrs-target-block which puts new basic blocks into the > hashtable. This sounds like a bug in nativecomp then, even if it happens not to = have any bad consequences right now. > Should the hashtable implementation detect such situations and perhaps > signal an error or a warning? Not unless it can be done at basically no cost. This is not a very = common mistake and letting all correct code pay for it wouldn't be a = good trade-off.