unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: Qs on free variable occurrences
Date: Sat, 6 May 2006 07:57:43 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICEELHDFAA.drew.adams@oracle.com> (raw)
In-Reply-To: <DNEMKBNJBGPAOPIJOOICEEHPDFAA.drew.adams@oracle.com>

Resending, as I got no reply. Suppose this variable were not predefined in
C. Would the Lisp coding style used be appropriate in that case, or should
the variable be declared via `defvar'?

        Consider variable `minibuffer-history-position', in library
        simple.el.

        1. It is bound (`let') in function `repeat-complex-command'.

        2. It is assigned a value at the top level of the file.

        3. It is both used (evaluated) and assigned a value in
           functions `previous-matching-history-element' and
           `next-history-element'.

        4. Byte-compiling the file gives no warning of the variable
           being used as a free variable (in #3 and #4).

        This is not a criticism, but a couple of questions.

        a. Why #4? Is it because the byte-compiler cannot detect these
           as free occurrences of the variable or is it intentional
           (TRT)? If the latter, what's the rationale?

        b. Is this coding style considered good or bad? In particular,
           should `minibuffer-history-position' be declared a global
           variable by giving it a defvar?

        Just trying to learn. Supporting reasons would help me understand.

    `C-h v' says that this variable is defined in C source code. That
    would perhaps explain #4. I still wonder about the coding style.
    Consider my questions in a context where the variable was not
    predefined in C. Thx.

  reply	other threads:[~2006-05-06 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-01 21:25 Qs on free variable occurrences Drew Adams
2006-05-01 21:29 ` Drew Adams
2006-05-06 14:57   ` Drew Adams [this message]
2006-05-07  5:00     ` Richard Stallman
2006-05-07 14:54       ` 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=DNEMKBNJBGPAOPIJOOICEELHDFAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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).