From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: add-hook and defvar Date: Mon, 23 Feb 2015 05:10:10 +0000 Message-ID: References: Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0158ad58996391050fba6a6e X-Trace: ger.gmane.org 1424668234 2980 80.91.229.3 (23 Feb 2015 05:10:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Feb 2015 05:10:34 +0000 (UTC) Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 23 06:10:33 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 1YPlHt-0003oP-JY for ged-emacs-devel@m.gmane.org; Mon, 23 Feb 2015 06:10:33 +0100 Original-Received: from localhost ([::1]:42082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPlHs-0001Cb-Ja for ged-emacs-devel@m.gmane.org; Mon, 23 Feb 2015 00:10:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPlHY-0001CW-71 for emacs-devel@gnu.org; Mon, 23 Feb 2015 00:10:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPlHX-0007n4-7t for emacs-devel@gnu.org; Mon, 23 Feb 2015 00:10:12 -0500 Original-Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:42554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPlHW-0007my-WF for emacs-devel@gnu.org; Mon, 23 Feb 2015 00:10:11 -0500 Original-Received: by labgf13 with SMTP id gf13so16183667lab.9 for ; Sun, 22 Feb 2015 21:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=ZZFHfVyaVI+AThjDy6QRKayqQNXzxCXHchM7WOgvQt8=; b=YGaG1B02Uaor5Gi4yPt0W7N8fYfUCTR0bQ8XeczwocC8f2yYl3cBKc5wJqd1Pn+MgJ Po1RdWGANyc1BW2TV642VzYqs3zfswQtYAbCu8+/iR7o8rK8gFmiMNpEYzMtNEpPdAij 5JWwICyGz6J8Y7TguY3Ln2y9Qz0onjtfURDB76jrbq09v0sGMR7IPAznvbpr0ElArMrp ci9i7gDgb1pnmOpNyhWWFQH6n8oQdEdJk21JreTm5KSa7Xc/SfG2/EgyE5GZ6hN+F+Hi LtFbDsr8ZjmpH7eyfhcyVjcxwdleGteq2I1IgEjcFZ2QpEeXitCcK8R4VQZRe6EaTMXJ C0jw== X-Received: by 10.152.21.167 with SMTP id w7mr8306600lae.14.1424668210322; Sun, 22 Feb 2015 21:10:10 -0800 (PST) Original-Received: by 10.112.49.9 with HTTP; Sun, 22 Feb 2015 21:10:10 -0800 (PST) Original-Received: by 10.112.49.9 with HTTP; Sun, 22 Feb 2015 21:10:10 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: Rnf7Sih0U1dWX1SbB7QMfJsgLl0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22b 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:183415 Archived-At: --089e0158ad58996391050fba6a6e Content-Type: text/plain; charset=UTF-8 On Feb 22, 2015 4:18 PM, "Stefan Monnier" wrote: > > > There's also the disadvantage that it adds a symbol-property check to > > every `defvar' call. > > That's a fairly significant disadvantage. Yes. We can also just throw an error if the variable isn't defined, like every other function out there. We can do that as a new function, `add-to-hook', and slowly obsolete add-hook. > Another problem is that defvar may simply never be called. But isn't it a bug to run-hooks a variable that was never explicitly defined? --089e0158ad58996391050fba6a6e Content-Type: text/html; charset=UTF-8


On Feb 22, 2015 4:18 PM, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:
>
> > There's also the disadvantage that it adds a symbol-property check to
> > every `defvar' call.
>
> That's a fairly significant disadvantage.

Yes. We can also just throw an error if the variable isn't defined, like every other function out there.

We can do that as a new function, `add-to-hook', and slowly obsolete add-hook.

> Another problem is that defvar may simply never be called.

But isn't it a bug to run-hooks a variable that was never explicitly defined?

--089e0158ad58996391050fba6a6e--