[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openmcl-bug
Subject:    Re: [Bug-openmcl] symbol macros and *MACROEXPAND-HOOK*
From:       Gary Byers <gb () clozure ! com>
Date:       2004-08-06 23:21:26
Message-ID: 20040806165917.V60535 () clozure ! com
[Download RAW message or body]



On Fri, 6 Aug 2004, Chris Wright wrote:

> I think this is technically a bug, if I'm reading the spec correctly,
> but I don't think it's very important.  Certainly, nothing I'm doing is
> depending on it.
>
> According to Hyperspec section 3.1.2.1.1, expansion of symbol macros
> should go through *MACROEXPAND-HOOK*, just like regular macros, but
> this is not the case in OpenMCL.  Since OpenMCL doesn't have any actual
> macro expansion functions for symbol macros, and nobody has complained
> about this before (that I know of), it looks like the only real gain
> here is more 'ANSI compliance'.
>

It's probably worth fixing this.  I think that the concept of an
implicit symbol-macroexpansion function was a relatively late (e.g., 10
or 11 years ago ...) addition to ANSI CL.

I'm not 100% certain that everything that expands symbol macros goes
through the function CCL::%SYMBOL-MACROEXPAND-1; that function can
find a symbol macro definition in a lexical environment, in the
compilation environment, or globally (it looks like it should give
up if it finds a shadowing lexical binding, without looking in the
global environment.)  In each case where it returns

(VALUES expansion T)

it could be made to return

(VALUES (FUNCALL *MACROEXPAND-HOOK* #'(lambda (sym env)
                                        (declare (ignore sym env))
				        expansion)
	                             sym env)
        T)


That might be useful to someone who's actually using *MACROEXPAND-HOOK*
for some reason (profiling macro usage ?).


The fact that:

(define-symbol-macro foo 17)

(let* ((foo 12))
   foo)

might return 17 is probably of greater concern (that's clearly wrong.)

Thanks.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic