emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs design and architecture. How about copy-on-write?


From: Ihor Radchenko
Subject: Re: Emacs design and architecture. How about copy-on-write?
Date: Wed, 20 Sep 2023 09:59:45 +0000

Emanuel Berg <incal@dataswamp.org> writes:

> Ihor Radchenko wrote:
>
>> Because implementation details are tricky - a lot of Elisp
>> internal machinery is relying upon modifying global symbol
>> objects [...]
>
> Yeah, but that should be fine, as long as they are locked and
> unlocked safely, right?

No.

If we have something like (let ((case-fold-search t)) ...), we will lock
`case-fold-search' symbol for the whole duration of `let' call and block
any other threads trying to alter `case-fold-search' locally.

> But, if one aspire to reduce the number of global variables
> used, a great way of doing that is lexical `let'-closures,
> here is an example that allows for the same default value when
> the function is called from Lisp and when used as an
> interactive command, yet the data is only hardcoded once for
> each variable.

Not every variable can be used within lexical scope. In particular
special variables (see 12.10.4 Using Lexical Binding and
`special-variable-p') are always treated outside lexical binding.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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