emacs-devel
[Top][All Lists]
Advanced

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

Re: "after" variable watchers


From: martin rudalics
Subject: Re: "after" variable watchers
Date: Mon, 17 May 2021 18:41:09 +0200

> I haven't seen vary many truly useful designs based on such a mechanism.
> It would be good to understand why.
>
> I think the basic problem is that the "deeply nested fashion" you
> mention is often quite complex, and many times ends up depending on
> other variables that are not yet modified.
>
> Consider your example: what if the new value for `right-margin-width'
> makes sense only after some other variables are also changed.  Say,
> variables controlling fringe or scroll bar width, etc.  If those
> variables are set by code after `right-margin-width' then the "valid
> right-margin-width" predicate would reject the value even though it will
> soon be valid.

No sane value will be ever rejected any more.  That's one of the major
clues of the new design.  Rather, the value will be stored as "nominal"
internally and get "realized" whenever that's possible.

> What we end up with is a situation where not only the final state must
> be valid (from the point of view of the watch function), but all
> transient states too.

Right, if "valid" means "sane".  A `right-margin-width' of 500 columns
will be valid even if will never fit on your frame.

> I have personally found systems like this to be
> difficult to deal with.

A user will not have to care about transient and final states.  Every
state must be valid and none is the final one.  After you're through
with the changes cited above you may want to resize your frame and you
will end up in the next transient state.

> The solution I most often I see is designs based on "dirty" state, where
> some point in the future code is triggered to validate state state.  For
> that I think the current watch mechanism is sufficient to track which
> variables have changed?

Please read my answer to Eli.  Maybe it clarifies things a bit.  In
fact, the "after" variable watcher is needed to produce a "valid
transient state" which can be either displayed immediately or kept
pending until the next transient state has been produced.

martin



reply via email to

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