From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] (Updated) Run hook when variable is set Date: Wed, 18 Feb 2015 17:37:00 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1424299069 25871 80.91.229.3 (18 Feb 2015 22:37:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Feb 2015 22:37:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kelly Dean Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 18 23:37:38 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YODFQ-0000SF-NI for ged-emacs-devel@m.gmane.org; Wed, 18 Feb 2015 23:37:36 +0100 Original-Received: from localhost ([::1]:53787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YODFQ-00059K-35 for ged-emacs-devel@m.gmane.org; Wed, 18 Feb 2015 17:37:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YODFL-00053q-4M for emacs-devel@gnu.org; Wed, 18 Feb 2015 17:37:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YODFH-0006XI-Rx for emacs-devel@gnu.org; Wed, 18 Feb 2015 17:37:31 -0500 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:60667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YODFH-0006X8-ML for emacs-devel@gnu.org; Wed, 18 Feb 2015 17:37:27 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id F0EF285C96; Wed, 18 Feb 2015 17:37:26 -0500 (EST) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id C2FF71E5B74; Wed, 18 Feb 2015 17:37:00 -0500 (EST) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id A4B67B4102; Wed, 18 Feb 2015 17:37:00 -0500 (EST) In-Reply-To: (Kelly Dean's message of "Tue, 17 Feb 2015 02:22:54 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 132.204.24.67 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183272 Archived-At: > Surely you can't say with a straight face that binding to unboundedness is > not an absurd concept. Where does the manual say such a thing? AFAICT this absurd concept comes from your interpretation of what's going on, and just shows that your interpretation is not a good model. > Either way, the behavior of makunbound is wrong. You've said so enough times, but I haven't heard any concrete alternative proposal so far. Not that I'd advise you to spend time on it, since this is a complete non-problem as far as I'm concerned. >>>> - OLDVAL is either a list of one element containing the old value, or >>>> nil (when that old value is Qunbound). >>> Then run_varhook must cons. That'll generate a lot of garbage if you us= e it >>> for profiling, or for debugging in a way where you don't just pause to >>> inspect every hooked variable. Is that ok? >> I think it's OK, yes. > This seems to be the least-bad option, so I did it this way, even though = it > makes the API a bit gross. Unfortunately, when you do: > (require 'cl) > (setq x 0) > (symbol-hook 'x) > (benchmark-run-compiled 100000 (incf x)) > it now spends half the time doing garbage collection. That's a high price= to > pay to cater to the brain-dead misbehavior of makunbound. Agreed. Another option is to pass 2 more arguments, i.e. pass "OLDVAL OLDBOUND NEWVAL NEWBOUND". You still have the problem of returning whether the actual new value should be bound or not. I see you decided to use a special (uninterned symbol) value instead. That's OK with me. > so to account for the inversion, it would have to change to: > if (!writeable) a...; > else b...; > which introduces an extra =ABnot=BB operator. This operator has 0 cost since any decent compiler will just swap the two branches of the `if' instead of performing an actual `not' computation. Stefan