"defined?" wants to be an `acro' (and not a macro)

Marius Vollmer (mvo@zagadka.ping.de)
05 Nov 1996 20:39:10 +0100

Hi,

I think the builtin macro/syntax "defined?" (defined in eval.c)
should be an `acro' and not a macro as it currently is.

Macros are supposed to expand a Scheme expression into another
expression that gets substituted for the original one. Acros (as I
understand them) are just like ordinary functions except that they get
their arguments unevaluated. They are supposed to return a value that
will be the value of the original expression.

Now, "defined?" is defined as a macro, but it returns a value, either
#t or #f. That value gets substituted in place of the original
expression in the source code and the result of the first evaluation
is fixed for all time. IMO, this is wrong. At least my experimental
`tree-compiler' gets confused by it.

A quick fix that would make me happy is:

*** libguile.orig/eval.c Mon Nov 4 22:15:09 1996
--- libguile/eval.c Mon Nov 4 23:39:59 1996
***************
*** 2924,2930 ****
scm_i_atcall_cc = scm_make_synt ("@call-with-current-continuation",
scm_makmmacro, scm_m_cont);

! scm_make_synt ("defined?", scm_makmmacro, scm_definedp);

#ifdef DEBUG_EXTENSIONS
scm_i_enter_frame = SCM_CAR (scm_sysintern ("enter-frame", SCM_UNDEFINED));
--- 2924,2930 ----
scm_i_atcall_cc = scm_make_synt ("@call-with-current-continuation",
scm_makmmacro, scm_m_cont);

! scm_make_synt ("defined?", scm_makacro, scm_definedp);

#ifdef DEBUG_EXTENSIONS
scm_i_enter_frame = SCM_CAR (scm_sysintern ("enter-frame", SCM_UNDEFINED));