Subject: [clisp-list] LET + custom:*x-encoding* (symbol macro) question

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Wed Apr 10 08:44:22 2002

Hi,

is the following behaviour to be considered a bug?

(defun test-sml ()
  (describe (sys::foreign-encoding))
  (let ((custom:*foreign-encoding* (ext:make-encoding :charset 'charset:mac-turkish)))
    (describe custom:*foreign-encoding*)
    (describe (sys::foreign-encoding)))
  (describe (sys::foreign-encoding)))
(test-sml)
#<ENCODING CHARSET:CP1252 :DOS> is an encoding.
#<ENCODING CHARSET:MAC-TURKISH :UNIX> is an encoding.
#<ENCODING CHARSET:CP1252 :DOS> is an encoding. <-!?
#<ENCODING CHARSET:CP1252 :DOS> is an encoding.

What is at question here is how transparent are symbol macros?

The normal way to temporarily bind specials is by LET. Should that still be the case with symbol-macros, e.g. should the user know that some variable is not a normal special, but rather a symbol macro?
Why have symbol macros if they can't remain well hidden?

Should the compiler recognize symbol macros, and generate
code equivalent to macros3.lisp:LETF for them, or not?

[42]> (describe 'custom:*foreign-encoding*)
*FOREIGN-ENCODING* is the symbol *FOREIGN-ENCODING*, lies in #<PACKAGE 
CUSTOM>, is accessible in the packages COMMON-LISP-USER, CUSTOM, EXT, FFI, 
LDAP, SCREEN, SYSTEM, a variable (macro: (SYSTEM::FOREIGN-ENCODING)), value: 
#<SYMBOL-MACRO (SYSTEM::FOREIGN-ENCODING)>.
For more information, evaluate (MACROEXPAND-1 '*FOREIGN-ENCODING*).
 #<PACKAGE CUSTOM> is the package named CUSTOM.
 It exports 47 symbols to the package EXT.
 #<SYMBOL-MACRO (SYSTEM::FOREIGN-ENCODING)> is a symbol macro handler.

Using CLISP-2.28 (MS-Windos-2000 with MS-VC6).

Thanks,
	Jörg Höhle.

---

From: Sam Steingold <[email-masked]>
Date: Wed Apr 10 09:25:05 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] LET + custom:*x-encoding* (symbol macro) question"
> * Sent on Wed, 10 Apr 2002 17:43:41 +0200
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>

this is correct, as per the spec.
lexical bindings shadow symbol-macro definitions.

> The normal way to temporarily bind specials is by LET. Should that
> still be the case with symbol-macros, e.g. should the user know that
> some variable is not a normal special, but rather a symbol macro?

I don't think so.

-encodings* are symbol-macros so that some error-checking is done at
SETQ time, not at use time.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
The only thing worse than X Windows: (X Windows) - X