From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: "after" variable watchers Date: Mon, 17 May 2021 18:41:09 +0200 Message-ID: <1fef80fb-0b6f-14d9-e763-21ab9ecf652f@gmx.at> References: <878s4dwgp8.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34320"; mail-complaints-to="usenet@ciao.gmane.io" To: Matt Armstrong , emacs-devel , Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 17 18:51:53 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ligT8-0008m0-8i for ged-emacs-devel@m.gmane-mx.org; Mon, 17 May 2021 18:51:50 +0200 Original-Received: from localhost ([::1]:48162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ligT7-0002ho-9E for ged-emacs-devel@m.gmane-mx.org; Mon, 17 May 2021 12:51:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ligIu-0003Mx-Ga for emacs-devel@gnu.org; Mon, 17 May 2021 12:41:16 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:42847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ligIs-0001sp-EV for emacs-devel@gnu.org; Mon, 17 May 2021 12:41:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621269671; bh=pNssh2nE1yINudF8WB/QMVOcFUS9OeK+30J9GDppUBM=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=VZ0Dj5gq3OdpJa4HTbGPhOb/3m9ZWK1+tPcEbRPjr6P9NDRuyLcLeMZQTMLlDyt8m 994U6NclErFIkQHoDUWZHZgZIeAnQkjGIeUXVcHGpnG31KMCOLXc4mGdSuVvPP78WO xrcml4zM+7fok+q6xGJOREHhRRYSBJ7Pwme5w2ZY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([213.142.96.78]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MCbEf-1lZe0i2UFP-009lEN; Mon, 17 May 2021 18:41:11 +0200 In-Reply-To: <878s4dwgp8.fsf@rfc20.org> Content-Language: en-US X-Provags-ID: V03:K1:qFm0PvyPFICRy4/IuuYcfRQo8sxs2p5OmrGAIcBDp8keGjL8HtZ iCuCGh1KLACFfYHNLVwQKkeBBNJle0vAltPu5LvioQxoB3wmZGU3jmaogG/qNQhU07mfbd+ Mkr3rV+uwnzxOqisvJ8OjwWqBZSzzp4Ys4Vis9VB0YKHgFW0ePFxBfmnYpRNcAKd5p4bQzZ YNzz/8/tAk97zT4JNX1sw== X-UI-Out-Filterresults: notjunk:1;V03:K0:qcZtyFtTBNM=:y5HCUzeos87tbJpcBKC+jt iOgBcgbclC+BRM87yBW7Cudn58KqLrkKwy2BNMU7vh7HxXQSdoS94mXUFDvhUhHHekJOU3QFJ dGZDnVd11iz7RkAKmULtnSF8hg16CTaEGqaOjz/B9X8/LDNyColXeGNbxEUgKT9YbFhQXywtM L2vCG1rVQhpDraoba3LyplpA7sAMJP9v8xRAcsfHMM7PLMNPi/lVatcFLvWtPY/U0E+ubl8Aj 5KnDxkYV3HVLbSrLfD5dZW5F1wB9HvkeYqxlm5JWd4jzg8H15+vuBlh6JYt+vPsEm9eNm5QpX dPoHmjY3cj5Dc6JC41d7satp52uyc8Ark1MWPFQC/73ogC/ics0pxzHzBpYyCFjA7sdkINrHf kRi66hS/foZHykvN0DelplO3QILl+xRQ8x4xWsvyzBsQJhAy487Y0AOsaMgWTct2xooQAX4sS Y1OjU26ER8cz5Vs4CLjd46i40GLWx8kMOPPJFqo+NS7OlIQ91NKcp4Pj0XDzMvutKcSqyM2yU fvqJP3ziHbzsPd+oIC5UZKejrsnDJFswNscCZi7/q3w15syjG4Cxv8JZVSDumvlgYK48PuBfF FDJF+dX4nbeVocIZ3Y+TCo9z2N3lt9ZwUxKRJjxm8qJmDewX0Up2eHeD7Wx//zbOH5JidvNQC VNg7SrzDlHdrpmjJsIsuuWqB/A3VWSycIXNzf5wWkP6/pOmj75X1Liqvcy60x8uWwojR3dM29 WLiqTHis2h4Ytc5pKdsfqHkjOMlczvT5fsi1Oh51D+vwrRUOHYUijqR4HKnfuCQwhK7eZ8bj Received-SPF: pass client-ip=212.227.15.19; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:269414 Archived-At: > 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