<Mirko.Vukovic@gmail.com> wrote:
+---------------
| I would like to define a package that defines values of physics
| constants. I would than import some of these constants into my
| working package. But I would like to rename the constants.
|
| For example, suppose I have a constant defined as *speed-of-light* in
| the :physics-constants package. But that is long and overly
| descriptive, and in my working package I would like to use "c".
|
| Now I guess I could write a macro wrapper to use-package when it comes
| to importing variables from my physics-constants package. (Or maybe
| package is overkill for my purpose. I could use some kind of hash and
| rename on the fly.)
+---------------
Ouch! That sounds way too heavyweight for simple renaming of a few
constants. What about just using DEFINE-SYMBOL-MACRO? E.g.:
(define-symbol-macro +c+ physics-constants:+speed-of-light+)
Note: Just as *...* is conventionally used for special variables
(DEFVAR/DEFPARAMETER), +...+ is the CL convention for constants
(DEFCONSTANT). Though calling it simply "C" probably isn't an issue
in this case, since names defined with DEFINE-SYMBOL-MACRO *can* be
lexically rebound with LET or SYMBOL-MACROLET. [Names defined with
DEFCONSTANT can't.]
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607