unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: RE: describe-variable with string arg
Date: Fri, 23 Mar 2007 15:57:44 -0700	[thread overview]
Message-ID: <EIENLHALHGIMHGDOLMIMCEBHDAAA.drew.adams@oracle.com> (raw)
In-Reply-To: <BDEIJAFNGDOAGCJIPKPBKEHECDAA.drew.adams@oracle.com>

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.

  parent reply	other threads:[~2007-03-23 22:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-23 22:37 describe-variable with string arg Drew Adams
2007-03-23 22:52 ` Stefan Monnier
2007-03-23 22:57 ` Drew Adams [this message]
2007-03-23 23:57   ` Drew Adams
     [not found] <46045DA3.9000709@gmail.com>
2007-03-23 23:15 ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EIENLHALHGIMHGDOLMIMCEBHDAAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).