all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: larsh@math.ku.dk, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: void variable
Date: 20 Aug 2004 10:54:53 -0400	[thread overview]
Message-ID: <jwvy8k9c2nx.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200408200127.i7K1Rpi00213@raven.dms.auburn.edu>

> Of course, `defcustom' has exactly the same problem as `defvar'.  So
> doing this for defvar and not defcustom seems inconsistent.  Strictly

Indeed.  We had already mentioned defcustom, but I'd forgotten about it.
But now that I looked at it, I also see that it's a bit ugly to do
(ideally, defcustom would use defvar internally, but given the way
custom is supposed to work, it's not easy to do).  We'd probably need to
create a new function like `outer-default-boundp' just for that.

> speaking, `defconst' also has the same problem, but let-binding a
> variable defined with defconst seems very iffy in any circumstances.

The situation for defconst is a bit different indeed.
The byte-compiler already warns when we do

   (defconst toto 1)
   (let ((toto 2)) (balbla))

It doesn't do that if the defconst was in another file, tho (because after
the defconst is executed Emacs does not remember whether it was a defconst
or a defvar or a setq).  We could easily add a bit in the symbol to keep
track of which vars are "const" to work around this (my own local Emacs
branch has had that for a while, even making all `defconst'd variables
read-only).

> The message:  VAR is still globally unbound
> looks cryptic.

:-)

> "Can't bind `foo-bar' globally: `let' around `defvar'"
> I would prefer:
> "Warning: defvar for locally bound `%s' failed to globally define it."
[...]
> For one thing, local bindings are not always made with `let'.

I like having `defvar' and `let' in the message.  How about:

   "Warning: defvar ignored because %s is let-bound"

Or maybe "skipped" or "failed" is better than "ignored".

> Anyway, somebody with a reasonably fast machine may only see this when
> studying the *Messages* buffer.  It easily can be overwritten by
> messages like:

Actually I think the problem can show up on a slow machine just as well.
But it's nothing new and is not specific to this particular case.


        Stefan

  reply	other threads:[~2004-08-20 14:54 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-25  6:32 void variable Lars Hansen
2004-07-25  7:56 ` Adrian Aichner
2004-07-25 19:25 ` Lars Hansen
2004-07-25 20:46   ` Luc Teirlinck
2004-07-25 21:54     ` Lars Hansen
2004-07-25 23:39       ` Luc Teirlinck
2004-07-25 23:54         ` Luc Teirlinck
2004-07-26  1:52       ` Luc Teirlinck
2004-07-26  2:13         ` Luc Teirlinck
2004-07-26 14:30           ` Richard Stallman
2004-07-26 15:12             ` Lars Hansen
2004-07-27 18:18               ` Richard Stallman
2004-07-29  2:31                 ` Luc Teirlinck
2004-07-29  7:19                   ` Lars Hansen
2004-07-30  3:21                     ` Luc Teirlinck
2004-07-30  6:56                       ` Lars Hansen
2004-07-30  4:55                   ` Richard Stallman
2004-07-26 15:21             ` Luc Teirlinck
2004-07-27 18:18               ` Richard Stallman
2004-07-26 16:05             ` Kai Grossjohann
2004-07-26 18:40               ` Lars Hansen
2004-07-27 18:18               ` Richard Stallman
2004-07-26  3:13     ` Richard Stallman
2004-07-26 19:23     ` Stefan Monnier
2004-07-26 19:46       ` Lars Hansen
2004-07-26 19:46       ` David Kastrup
2004-07-26 20:41       ` Luc Teirlinck
2004-07-26 21:13         ` Stefan Monnier
2004-07-27  2:59           ` Luc Teirlinck
2004-07-27  3:07           ` Luc Teirlinck
2004-07-27  3:09           ` Luc Teirlinck
2004-07-28 16:00         ` Richard Stallman
2004-07-29  2:00           ` Luc Teirlinck
2004-08-19 19:33           ` Stefan Monnier
2004-08-19 20:12             ` Adrian Aichner
2004-08-19 20:45             ` Davis Herring
2004-08-20 21:08               ` Richard Stallman
2004-08-20 22:08                 ` Stefan Monnier
2004-08-19 21:54             ` Andreas Schwab
2004-08-19 22:20               ` Stefan Monnier
2004-08-19 22:25                 ` David Kastrup
2004-08-20  1:27             ` Luc Teirlinck
2004-08-20 14:54               ` Stefan Monnier [this message]
2004-08-21 16:49                 ` Richard Stallman
2004-08-20 21:08             ` Richard Stallman
2004-07-26  1:29 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2008-04-17 19:54 J. David Boyd
2008-04-18  8:03 ` Carsten Dominik
2008-04-18 14:34   ` J. David Boyd
2008-04-18 15:02   ` J. David Boyd

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

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

  git send-email \
    --in-reply-to=jwvy8k9c2nx.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=larsh@math.ku.dk \
    --cc=rms@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.