emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Run hook when variable is set


From: Stefan Monnier
Subject: Re: [PATCH] Run hook when variable is set
Date: Thu, 29 Jan 2015 09:58:22 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> NACK from me.
> Why?  Just because of the slowdown for symbols that have property lists?

For the same reason I want to kill the `intangible' text-property: this
operates at too-low a level, so it's bound to introduce buggy
interactions between unsuspecting packages.

I like the idea of such hooks (which I've always thought of as
"watchers" rather than hooks), actually, but only for purposes such
as debugging.

If we want to use such hooks for purposes such as "automatically
recompute values of dependent vars", then I think the right way is to
introduce a new layer which checks&runs these hooks, using the "raw"
`setq' underneath.

That's what I've done to add an "fset hook" (where the above layer which
checks&runs the hook is `defalias'), but that was easy because the
layering was pretty much already there.

> I.e. if I eliminate the slowdown, then will you still have an
> objection to the feature?

Eliminating the slowdown is easy: extend the `constant' bit of
variables to have 3 values: normal, read-only, and "hooked".
This way normal vars are just as fast as before.

But yes, I would still object to the use of such a low-level mechanism
to solve your problem.

> And I explained why your code doesn't provide a complete solution.
> You didn't respond.

I must have misunderstood or overlooked it.  Can you retry?

> Obviously, there are additional uses for this feature too.  For just one
> example, without varhook, what solution would you propose for bug #19068?

For "a good solution" to bug#19068, we need to extend defcustom with
dependency management, and then we need to tell people to use something
else than `setq' (this something else will then be in charge of
triggering the defcustom dependency management).


        Stefan



reply via email to

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