From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: defvar without value Date: Tue, 31 Mar 2020 20:59:17 -0400 Message-ID: References: <87k1302htp.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="104875"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Emacs Development To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 01 03:00:12 2020 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 1jJRjm-000RAk-Rd for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Apr 2020 03:00:10 +0200 Original-Received: from localhost ([::1]:45610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJRjl-0007gt-T0 for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 21:00:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38396) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJRj0-0006vm-OU for emacs-devel@gnu.org; Tue, 31 Mar 2020 20:59:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJRiz-0003eA-CZ for emacs-devel@gnu.org; Tue, 31 Mar 2020 20:59:22 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:14659) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJRiz-0003cN-5Y for emacs-devel@gnu.org; Tue, 31 Mar 2020 20:59:21 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 664F481F06; Tue, 31 Mar 2020 20:59:20 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 88F9980A1F; Tue, 31 Mar 2020 20:59:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1585702758; bh=SsdaY0YfVcsYQntTirGsi4nuKuvwVzdu9Fk24mGaEf4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=k3CPiRUM3vH9P/rfDj4PI1Vx9AY4qvhbpZD+FWQJNi+KqgBUBsj2xjz18ezSa2bo/ x9wQEMHVuc+rEhr3Sn+NudEneybd6Wwjmlh/qGFFVsSshanGauV4ykmRtizi+ZGpna a146kJDXsMBZaO3Y9v0jy3XmEdx14GuwgfwdIFJCEgtg1SZW0XxE+R3Gvi9bv+INFi 5aSDO8VqCxVRZofVdXohPQ0nr6Ugu5EtdUNNPnOX/OZak+eiGKmJY9wqrUSbbi/T3f L29A9+c04uXcMcb6uswnk0tLc8TkBJLuX/lKehXU3iiBC42FAnD6i6EJ1uRIgOZ1mo VJ3Zz3nhGg3rQ== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5251E12033E; Tue, 31 Mar 2020 20:59:18 -0400 (EDT) In-Reply-To: <87k1302htp.fsf@web.de> (Michael Heerdegen's message of "Wed, 01 Apr 2020 02:03:14 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 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:246170 Archived-At: > Using `defvar' (on top-level) without specifying a value differs in two > ways from calls that specify a value: (1) the variable's value is not > set, and (2) the variable is made special only in the context of the > (rest of the) current file or buffer. > > I wonder if it is good that these two things are chained together, and > if there are alternatives to what we have now. I guess we could add something like (defvar-dynamic VAR) which sets the `special` bit on the variable, just like (defvar VAR VAL) does, but leaves the variable's value unchanged (currently, you'd have to do (progn (defvar VAR 'dummy) (makunbound 'VAR)) to get a similar effect). Similarly, we could add something like (defvar-lexical VAR VAL) which defines the var and sets it but doesn't set the `special` bit (currently, we have `internal-make-var-non-special` to serve the same need). Stefan