From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Newsgroups: gmane.emacs.devel Subject: Re: Q: BLV for function slots + BL obarray/hmap for symbol lookup? Date: Sun, 30 May 2021 14:44:57 +0200 Message-ID: <2779765C-6A7D-4342-BBFE-A774125A6EC5@gmail.com> References: <87r1hp675v.fsf@web.de> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) 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="23290"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , emacs-devel@gnu.org To: Arthur Miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 30 14:46:31 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 1lnKpr-0005ri-0i for ged-emacs-devel@m.gmane-mx.org; Sun, 30 May 2021 14:46:31 +0200 Original-Received: from localhost ([::1]:44886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnKpp-0001k8-Q5 for ged-emacs-devel@m.gmane-mx.org; Sun, 30 May 2021 08:46:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnKoS-0000xB-Rk for emacs-devel@gnu.org; Sun, 30 May 2021 08:45:05 -0400 Original-Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:54083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnKoP-0002tb-RG for emacs-devel@gnu.org; Sun, 30 May 2021 08:45:04 -0400 Original-Received: by mail-wm1-x329.google.com with SMTP id h3so4647169wmq.3 for ; Sun, 30 May 2021 05:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=sqT16BKyJhOdtYyjX2Wtl/SUBS12Db3dNuN8JBFOvZc=; b=Sp6RKqLRPbswgHpHG8w6wITwmZ9vQGnV4gbioMMb8Hs0KzlfljSXeyd6hjGfxdb+jd E1HEVolcRfGeB5TrdaZPWYI+GEfL91B6cDwRB3LD5euY5RNK11TLWi9/OxEKfoGvAQWq 0AV2sVwLmtgdWRXSk02ibtBJ7Iao3q0d+J+A7d8rdtbSqI7pZEgiZ0JFov5PoiwKojYc 6jq/4ArOb/l4LDJScLbMSTfTfEZYYmGZdUxwm3e1TteyR/q+lPjd/PI7QWgj2X4SOtE+ 1VKJqOumcxzOXz84JTBcHCNJFECCzdBv954l5Vt0OMMCM/Jy74zCcIp/JWVRk2MrGESN 7htw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=sqT16BKyJhOdtYyjX2Wtl/SUBS12Db3dNuN8JBFOvZc=; b=dGqAxY1gCGvcystG3sd1VKVAAjZQ4ns6ixcAwGEzaeJFAhbH7jbALTvLFoNpmx2qvJ lqKrq/UmMrJRLEpHv1KMGUOe0G0GBFgCpmaoAh/U91uF/pTqyHWjEzVoEi1DojJDHixY KZY6oKYTeTT1x4swvHWErdLg58hvQMqdEja3yKKTV1vdgmsky+pAM/UwduIqNb0rvppA oNJlAQhvDBpW3RkQVTkfgtim6PTe76QOjfQnkT2/K34HUIgU4lXMPg4wT8pgqQkuc/JT j0St7nDpXJ6xGjov/5ekvkSbto8nMmaWKTuIEDDHpnkfqIqovobQy0v3Uq8xxwTtsAxy hwbg== X-Gm-Message-State: AOAM532g2C1T3ANue9cmc+SKB+XMnrIcI2QH+djtRr17Xges9UOJ+WUf Ytmq2Mz90h423CemU8XWr/o= X-Google-Smtp-Source: ABdhPJysELP3k81EsetNxyOqh7k5108vcDTOnNe4xwyL2AMKzjdlqqd8J97+Fpr5dsLU6bc6b1+M8g== X-Received: by 2002:a05:600c:4894:: with SMTP id j20mr3129964wmp.131.1622378699097; Sun, 30 May 2021 05:44:59 -0700 (PDT) Original-Received: from smtpclient.apple ([46.128.198.100]) by smtp.gmail.com with ESMTPSA id n6sm11302955wmq.34.2021.05.30.05.44.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 May 2021 05:44:58 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.80.0.2.43) Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=p.stephani2@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, 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.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:270126 Archived-At: > Am 30.05.2021 um 04:57 schrieb Arthur Miller : >=20 > Michael Heerdegen writes: >=20 >> Arthur Miller writes: >>=20 >>=20 >>> (setq-local obarray (copy-sequence obarray)) >> ^^^^^^^^^^^^^ >>=20 >> I guess this is something different than with the originally = suggested >> `obarray-copy'. >>=20 >> I once was told that obarray is not just simply an array of existing >> symbols >=20 > You mean I got a shallow copy of the obarray instead of a deep copy? I wouldn't call it a shallow copy; you get a weird object that doesn't = behave as expected: (let ((a (obarray-make 1))) (intern "u" a) (intern "v" a) (let ((b (copy-sequence a))) (unintern "u" b)) (let ((syms ())) (mapatoms (lambda (s) (push s syms)) a) syms)) =3D> (v) Here, uninterning "u" from the "copy" has also removed it from the = original. >=20 > Where do I find this obarray-copy? :-) I don't see it in 27.1. It doesn't exist yet, you'll need to write it. For example: (defun obarray-copy (ob) (let ((r (obarray-make (obarray-size ob)))) (obarray-map (lambda (sym) (obarray-put (symbol-name sym) r))) ob) r)) >=20 >> (length obarray) =3D=3D> 15121 >=20 > Yes, I get the same apocalytpic number, surprise :). >=20 >> (let ((i 0)) (mapatoms (lambda (_) (cl-incf i))) i) =3D=3D> 66002 >=20 > I get 45416. >=20 > This is beyond my knowledge about how obarrays in Emacs are made. See the node "Creating Symbols" in the ELisp manual, which explains the = details. (Probably too well, since they are really implementation = details.) For the full picture, check the definition of 'struct Lisp_Symbol' in = lisp.h and the obarray functions in lread.c. Obarrays are rather weird objects that are not really well supported by = most Elisp functions. You can only work with them reliably using the = dedicated obarray functions (intern, unintern, mapatoms, the functions = from obarray.el).=