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: The purpose of makunbound Date: Wed, 18 Feb 2015 09:34:16 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1424270174 11010 80.91.229.3 (18 Feb 2015 14:36:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Feb 2015 14:36:14 +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 15:36:06 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 1YO5jR-0004Xo-V0 for ged-emacs-devel@m.gmane.org; Wed, 18 Feb 2015 15:36:06 +0100 Original-Received: from localhost ([::1]:51178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5jM-0003E8-FG for ged-emacs-devel@m.gmane.org; Wed, 18 Feb 2015 09:36:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5i2-0001X5-Rc for emacs-devel@gnu.org; Wed, 18 Feb 2015 09:34:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO5i0-0008Ij-6C for emacs-devel@gnu.org; Wed, 18 Feb 2015 09:34:38 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:55601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5i0-0008IV-38 for emacs-devel@gnu.org; Wed, 18 Feb 2015 09:34:36 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsTAPOG1lTO+LI//2dsb2JhbABbgwaDX4VTwGUEAgKBDUQBAQEBAQF8hA0BBAFWIwULCzQSFBgNJIg4CM4jAQEBAQYBAQEBHo94B4QqBYonjziOGoF5gUUihAwggTMkgRwBAQE X-IPAS-Result: ArsTAPOG1lTO+LI//2dsb2JhbABbgwaDX4VTwGUEAgKBDUQBAQEBAQF8hA0BBAFWIwULCzQSFBgNJIg4CM4jAQEBAQYBAQEBHo94B4QqBYonjziOGoF5gUUihAwggTMkgRwBAQE X-IronPort-AV: E=Sophos;i="5.09,536,1418101200"; d="scan'208";a="110817166" Original-Received: from 206-248-178-63.dsl.teksavvy.com (HELO pastel.home) ([206.248.178.63]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Feb 2015 09:34:35 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 6DC35175C; Wed, 18 Feb 2015 09:34:16 -0500 (EST) In-Reply-To: (Kelly Dean's message of "Wed, 18 Feb 2015 08:51:41 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:183247 Archived-At: >>> What's the use case of doing makunbound on a dynamically let-bound variable? >> What's the use case for disallowing it? > Catching errors. If some code F does makunbound on a symbol that it assumes > is currently used as the global variable, but F is called from some other > code that dynamically let-binds the symbol, then F will accidentally set the > dynamic variable to the special unboundedness value rather than unbind the > global variable. Why would that be an error? How often have you bumped into that error? > If that's a bogus thing to do, then by disallowing it, the interpreter could > catch the error. I don't know if that would be bogus or not, because I don't know why makunbound was called in your example. And remember: a (dynamically scoped) `let' does not necessarily mean to make a local binding, it can also be understood to mean to temporarily change the global variable (i.e. it's just a shorthand for (let ((old )) (unwind-protect (progn (setq ) ,@body) (setq old))) with the advantage that it doesn't burp in the first line of is unbound and it properly sets it back to unbound in the end in that case). You talk about "global variable" vs "dynamic variable", but that difference is only in your head because of the interpretation you chose. Stefan