emacs-devel
[Top][All Lists]
Advanced

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

Re: PACKAGE-FEATURES, and hot update of Emacs packages


From: Qiantan Hong
Subject: Re: PACKAGE-FEATURES, and hot update of Emacs packages
Date: Sun, 28 Nov 2021 07:51:33 +0000

>> Currently if the old package is not unloaded, the feature is still
>> present and (require p) does nothing.
> 
> Certainly `require' won't do anything, but nothing prevents you from
> using `load-library' for for the same list of libraries that you were
> planning to unload.
For a multi-file package, does (load-library entry-feature) also
loads the other files? I suppose it doesn’t because usually
the entry-feature use REQUIRE instead of LOAD-LIBRARY
to load its “components”.

An adhoc solution would be to temporarily override the definition
of REQUIRE that perform LOAD-LIBRARY if the feature to be
required is part of the package. It seems that we still need
PACKAGE-FEATURES to test it… still, it sounds super ad-hoc,
not sure how bad an idea it is.

Or maybe we can upgrade REQUIRE itself so that it reloads
when a feature file is modified?

> You can't be certain that's going to be safe, though.  Reloading a
> library is expected to be safe when the code is unchanged, but there's
> no requirement that I'm aware of to support loading new code over the
> old code -- that will often be fine in practice, but there's loads of
> scope for it not to be.
Your so-long library seems to have provided an excellent example
of supporting it, so I suppose it’s very doable in general.

> And as before, I don't think it's valid to unload things (even if you
> could be confident that everything supported being unloaded) because
> you destroy the configuration.
> 
> I can't think of a way to reliably do what you're suggesting in the
> general case.  Each approach will work in certain circumstances, but
> I don't think any approach is *generally* reliable.
As I suggested, reloading all packages/features dependent on a particular
package seems to do the trick, at least it will recover the init configs.
The conceptual model is also very clear — the operation basically
recover a part of the image state from external file system, 
sort of like loading an incremental image.
It might also be useful when the user corrupted the state of a particular
package and want to recover it.
In case that such recursive reloading might result in reloading too many
packages, we might provide a switch for recursive/non-recursive reloading,
and present a list of packages to be reloaded for the user to confirm.

Maybe we can have both :unloadable and :reloadable,
reload should be used in possible, and unload-then-load
can be used as a fallback or rescuing operation.


Best,
Qiantan

reply via email to

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