114 lines
6.2 KiB
HTML
114 lines
6.2 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Issue MACRO-SUBFORMS-TOP-LEVEL-P Writeup</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="../Issues/iss230_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss232.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss233_w.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="../Issues/iss230_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss232.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss233_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue MACRO-SUBFORMS-TOP-LEVEL-P Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss232.htm">MACRO-SUBFORMS-TOP-LEVEL-P</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/s_eval_w.htm#eval-when"><B>EVAL-WHEN</B></A>, <A REL=DEFINITION HREF="../Body/f_cmp_fi.htm#compile-file"><B>COMPILE-FILE</B></A>,<P>
|
|
all macros defined in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A><P>
|
|
Related issues: <A HREF="iss147.htm">EVAL-WHEN-NON-TOP-LEVEL</A><P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<B>Edit history:</B> v1, 13 Feb 1991, Sandra Loosemore<P>
|
|
v2, 11 Mar 1991, Sandra Loosemore<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
The compilation model defined by issue <A HREF="iss147.htm">EVAL-WHEN-NON-TOP-LEVEL</A> specifies<P>
|
|
that expansions of macros inherit "top-level-ness" from the macro call.<P>
|
|
This makes sense for user-defined macros, but users have no control<P>
|
|
over what the expansions of macros defined in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> are, since<P>
|
|
they're provided by the Lisp implementation. The semantics of a macro<P>
|
|
call form can depend on whether or not its subforms appear at top-level<P>
|
|
in the expansion, so the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> ought to place some constraints<P>
|
|
on what the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> macros can expand into.<P>
|
|
<P>
|
|
<B>Proposal (MACRO-SUBFORMS-TOP-LEVEL-P:ADD-CONSTRAINTS):<P>
|
|
</B><P>
|
|
Clarify that no subforms of calls to macros defined in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A><P>
|
|
inherit "top-level-ness" from the macro call unless explicitly stated<P>
|
|
otherwise. <P>
|
|
<P>
|
|
Clarify that no macros now in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> pass on "top-level-ness"<P>
|
|
to their subforms.<P>
|
|
<P>
|
|
Clarify that even if a macro is normally treated as a special form by <P>
|
|
the file compiler, both its handling as a special form and its normal<P>
|
|
macro expansion must still satisfy these constraints.<P>
|
|
<P>
|
|
Clarify that <A REL=DEFINITION HREF="../Body/f_docume.htm#compiler-macro"><B>compiler-macro</B></A> functions must ensure that expansions <P>
|
|
have the same semantics regarding inheritance of top-level-ness <P>
|
|
as the normal function or macro definition of the form.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
It fixes the problem.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Probably many implementations currently return macro expansions that<P>
|
|
violate these rules.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Implementors will have to examine the definitions of all macros they<P>
|
|
<A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> to make sure that they conform to these rules. Some <P>
|
|
"optimizations" currently performed may turn out to be invalid;<P>
|
|
for example, (and <form>)<P>
|
|
could expand into (let () <form>)<P>
|
|
but not (locally <form>)<P>
|
|
or (<A REL=DEFINITION HREF="../Body/s_progn.htm#progn"><B>progn</B></A> <form>)<P>
|
|
or <form><P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Probably none.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
User programs will behave differently in different implementations.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
Probably small.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
The cost of non-adoption is avoided.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
The whole business of "top-level-ness" is kind of ugly.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
It doesn't appear that any of the ~90 macros defined in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A><P>
|
|
<A REL=DEFINITION HREF="../Body/f_provid.htm#require"><B>require</B></A> special exceptions from the rule. Certainly none of the<P>
|
|
binding, conditional, or iteration macros ought to pass "top-level-ness"<P>
|
|
through.<P>
|
|
<P>
|
|
</PRE>
|
|
<HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|