emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q: BLV for function slots + BL obarray/hmap for symbol lookup?


From: Arthur Miller
Subject: Re: Q: BLV for function slots + BL obarray/hmap for symbol lookup?
Date: Sun, 23 May 2021 18:23:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> E.g. which buffer should be used to resolve the "buffer-localness"?
>>> The one when `intern` is called or the one when the already-interned
>>> symbol is used?
>>
>> I am not sure I understand what you mean here. The rule would be same as
>> for buffer local vars, but they would work on symbol level instead of
>> variable slot level, at least conceptually.
>
> E.g. when we `load` a file, the `current-buffer` is the one which
> happened to be current when the `load` function was called.
> Usually that's when `intern` is executed.  So if you just naively make
> `intern` use `current-buffer` to decide what to do, you may get very
> unpredictable behavior.

I am still not sure I understand the problem 100%, but I understand it
partially I think :). Thanks.

> Have you looked at the different attempts to add some kind of
> namespace support to Emacs?  Some of them may be particularly well
> suited to your DSL situation.  When writing our history of ELisp paper,
> we found: Fakespaces, Namespaces, with-namespace, Codex, Names, and
> Nameless (the last two are in GNU ELPA).

Once, some years ago it was very popular with namespaces, so I have
heard about some, read some rants on Wiki pages, but I didn't use Elisp
that much, so I never checked them out. Back then namespaces used to pop
up as completion frameworks does nowadays.

This is the first time I feel I would have real use for a namespace (I
peronally don't mind typing prefixes). Names package look like something
I'll investigate and see if it works or the approach you suggest below.

>> If "local obarray" is declafed in a buffer, all interning would go to
>> that one, like all set/qset set's the local vaalue if there is one.
>
> But how do you control which buffer is current when the `intern` takes place?
>
> Also, have you considered something like
>
>     (setq-local obarray (obarray-copy obarray))

You mean to copy Emacs global obarray into local variable, the other way
around so to say, and use that one all the way? I didn't :-). Feels a bit
drastic to a big global environment, but it might work, I'll have to try
it. Thanks for the suggestion(s).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]