From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: describe-variable with string arg Date: Fri, 23 Mar 2007 15:57:44 -0700 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1174690802 30995 80.91.229.12 (23 Mar 2007 23:00:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Mar 2007 23:00:02 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 23 23:59:56 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HUsji-0005Qm-E1 for ged-emacs-devel@m.gmane.org; Fri, 23 Mar 2007 23:59:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HUsle-0004S8-Tz for ged-emacs-devel@m.gmane.org; Fri, 23 Mar 2007 18:01:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HUsla-0004LZ-Nw for emacs-devel@gnu.org; Fri, 23 Mar 2007 19:01:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HUslZ-0004FI-2Z for emacs-devel@gnu.org; Fri, 23 Mar 2007 19:01:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HUslY-0004Eu-P1 for emacs-devel@gnu.org; Fri, 23 Mar 2007 18:01:48 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HUsjb-0005sM-80 for emacs-devel@gnu.org; Fri, 23 Mar 2007 18:59:47 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.186.112]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l2NMxi5u015832 for ; Fri, 23 Mar 2007 16:59:45 -0600 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw3.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l2NM5ZJM015903 for ; Fri, 23 Mar 2007 16:59:44 -0600 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-82-41.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 2558987671174690667; Fri, 23 Mar 2007 15:57:47 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68439 Archived-At: I said: > describe-variable expects a symbol, not a symbol-name (string). > > In Emacs 20, passing it a symbol name leads to an error message. Starting > with Emacs 21, the message is displayed via `message', not > `error'. AFAICT, no Emacs code depends on this use of `message' instead > of `error'. The latter makes more sense to me. Let me be clearer. This is a type error, and it should be treated as an error. To inform the user via a message is fine, but code that calls `describe-variable' should be able to use `condition-case' to detect and handle a `wrong-type-argument' error. Yes, such code could also check the arg type itself, but that assumes that it knows that it is dealing with `describe-variable' and that that function expects a symbol arg. If there were some important reason why `describe-variable' should not raise an error in this context, I would understand why `error' was changed to `message'. For example, if a return value were tested in code that calls `describe-variable'. But I don't see that happening anywhere in the Emacs code. What's more, the return value is a string in either case (`message' returns the message; otherwise, the help string is returned), so the return type cannot be tested. I see no reason that an error shouldn't be raised. > Beyond that, why not let `describe-variable' try a little harder, to use > `intern' applied to its arg, if that is a string? > > That would be friendlier to possible 3rd-party code that might generically > apply a function such as `describe-variable' to an arg that might be a > symbol name instead of a symbol. In sum, I'd like to see the treatment of an arg that is not a bound symbol be: . If an unbound symbol, raise an error saying so. . If a string, intern it and try again using the resulting symbol. . If any other type, raise a type error.