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 01:31:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt)

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

>> 1. Is there some special reason why BLV are implemented only for value
>> slots and not for function slots? Would it be inneficient, too
>> complicated, or just considered as not needed?
>
> 35 years of experience suggest it's not needed (thank god).
> It's quite easy to instead do something like
>
>     (defun foo (..)
>       (call foo-function ..))
>
> and then use a buffer-local setting for `foo-function` to get the same result.

Yeah, I know, it is exactly what I do know: defvar-local some-fn, and then save 
a
function in variable. However there is a fundamental restriction: if
there is already a foo defined, I can't use that name.

Beside, the obvious namespace problem, there is a thing I would like to
do, which I can't. If I would like to slightly modify a function, I can
either re-install my own version and do some conditional check to do own
thing or return original computation, or I could advice. Both of those
options have global effect in entire Emacs. It might be costly in terms
of performance, so in that case, I might use my own version just in some
buffer, leaving rest unnaffected.

>> 2. Would it be possible, not too inneficient, complicated etc, if obarray
>> or hashmap, whichever is used for symbol lookup by Emacs, could be defined
>> as BLV, so that Emacs would lookup symbols similar as it does for buffer
>> local variables?
>
> 35 years of experience suggest it's not needed (thank god).
It can also just mean that for 35 years people haven't being doing what
some people would like to do now? :) 

Can you give me anything on technical side of quesion? 

> Also, I think this could lead to quite unexpected semantics.

Ok, there you have something interesting. In which way? If you have time
to expand on that one. It is already possible to use custo obarray, but
we have to tell Emacs which obarray to use. I would like it to sort of
happen automatically if there is a buffer local one. Sort of. No idea
what would happen if there were more than one local :-). 

To explaing more:

I would like to have a private namespace, in this case it would provide
for a buffer-local namespae, if I can call it so.

It would be just one level: buffer-local or global. 

I don't want to write too long, but I would like to have a way to skip
prefixes in names and to be able to use ordinary elisp semantics of
defun, defmacro etc, but that work only on some "local" level. Buffer
local would be really nice. I could otherwise define my own DSL, but I
don't want to do that.



reply via email to

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