Subject: Re: Please check this bit of Lisp (how ugly is my code?)
From: (Rob Warnock)
Date: Mon, 28 May 2007 19:49:50 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Rainer Joswig  <> wrote:
| If you use DEFPARAMETER (and top-level variables) NEVER (!!!)
| use variable names like s, i, x, and so on. DEFPARAMETER
| declares a variable special and that would mean
| that local (!!!) variables with those names will be
| special, too! Convention is to use something like *s*. 

That's why I (nearly) always use my DEFLEX macro[1] for such
top-level manually-typed variables -- it uses DEFINE-SYMBOL-MACRO
to redirect to a (related) constructed *...* name so that the
top-level variable *can* be lexically re-bound:

    > (deflex foo 11)

    > (defparameter *bar* 22)

    > (defun top-vars () (list foo *bar*))

    > (let ((foo 33)
	    (*bar* 44))
        (list* :local foo *bar* :global (top-vars)))

    (:LOCAL 33 44 :GLOBAL 11 44)

It prevents a lot of accidents while still allowing the
convenience of names like FOO, BAR, X, Y, Z, I, J, K, S, etc.

[Though you still have to avoid names like "T"!  ;-}  ]


[1] See <>
    (barely a month ago) for my latest version, along with a
    pointer to a required patch to CMUCL-19c or earlier for
    symbol-macro handling in MACROEXPAND-1.

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607