unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Arthur Miller <arthur.miller@live.com>
Cc: emacs-devel@gnu.org
Subject: Re: Q: BLV for function slots + BL obarray/hmap for symbol lookup?
Date: Sat, 29 May 2021 22:44:59 -0400	[thread overview]
Message-ID: <jwvo8ctymld.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AM9PR09MB49776CB804D283E22143155696209@AM9PR09MB4977.eurprd09.prod.outlook.com> (Arthur Miller's message of "Sun, 30 May 2021 04:30:24 +0200")

Arthur Miller [2021-05-30 04:30:24] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>>>     (setq-local obarray (obarray-copy obarray))
>> [...]
>>> (setq-local obarray (copy-sequence obarray))
>>
>> obarray-copy != copy-sequence
> My Emacs 27.1 says void function obarray-copy,

Indeed, it's not provided.

> but copy-sequence worked.

Not really, no.  You just haven't noticed the breakage yet.

>  Aren't obarray just vectors?

No, they're very special vectors.  E.g.:

    (let ((oa (make-vector 1 nil)))
      (intern "foo" oa)
      (intern "bar" oa)
      (intern "baz" oa)
      oa)

    ==>

      [baz]

Yet, `foo` and `bar` are definitely still in there.

> For your previous mail; yes I am quite aware this is very use-case
> specific solution. Anything done elsewhere, outside that particular
> buffer after the copy is performed will not be visible in that buffer,
> as well as no definition will escape to rest of the Emacs, so this
> buffer can only be used to change state of this particular buffer and
> nothing else, and that can be quite brittle. For the bad and good. I
> haven't experimented enough yet, just a bit, I am not sure how it will
> work with Emacs state internally, gc? etc.

AFAIK I think it can be made to work, yes.
I don't expect any problem from "Emacs state internally" or the GC.

The only source of trouble I can foresee is if "normal code" ends up
running while your obarray is the one held in the global `obarray` var.
This is because "normal code" will occasionally load files (via
`require` or autoloads, typically) and that can quickly lead to
confusion.


        Stefan




  reply	other threads:[~2021-05-30  2:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 21:46 Q: BLV for function slots + BL obarray/hmap for symbol lookup? Arthur Miller
2021-05-22 22:30 ` Stefan Monnier
2021-05-22 23:31   ` Arthur Miller
2021-05-23  3:25     ` Stefan Monnier
2021-05-23  9:00       ` Arthur Miller
2021-05-23 15:27         ` Stefan Monnier
2021-05-23 16:23           ` Arthur Miller
2021-05-29  7:31             ` Arthur Miller
2021-05-29 12:44               ` Michael Heerdegen
2021-05-30  2:57                 ` Arthur Miller
2021-05-30 12:44                   ` Philipp
2021-05-29 13:47               ` Stefan Monnier
2021-05-30  2:30                 ` Arthur Miller
2021-05-30  2:44                   ` Stefan Monnier [this message]
2021-05-30 12:17                     ` Arthur Miller
2021-05-29 13:56               ` Stefan Monnier
2021-05-23 18:22 ` Clément Pit-Claudel
2021-05-23 20:23   ` Arthur Miller
2021-05-23 21:41     ` Clément Pit-Claudel
2021-05-24 12:37       ` Arthur Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvo8ctymld.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).