141 lines
7.5 KiB
HTML
141 lines
7.5 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 STEP-ENVIRONMENT 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/iss324_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss325.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss326_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/iss324_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss325.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss326_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue STEP-ENVIRONMENT Writeup</H2>
|
|
|
|
<PRE><B>Status:</B> Passed, Jan 89 X3J13, as amended<P>
|
|
<P>
|
|
<B>Issue:</B> <A HREF="iss325.htm">STEP-ENVIRONMENT</A><P>
|
|
<P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> (CLtL p.441)<P>
|
|
<A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A> (CLtL p.441)<P>
|
|
<P>
|
|
<B>Category:</B> CLARIFICATION/CHANGE<P>
|
|
<P>
|
|
<B>Edit history:</B> Version 1, 12-Mar-88, Moon<P>
|
|
Version 2, 10-Jun-88, Masinter (add discussion)<P>
|
|
Version 3, 20-Jun-88, Loosemore (not a special form)<P>
|
|
version 4, 17-Mar-89, Masinter (as amended)<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B> <P>
|
|
CLtL does not specify in what lexical environment the form given to <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A><P>
|
|
is evaluated. Some people think it's supposed to be evaluated in the<P>
|
|
null environment, others think it is supposed to be evaluated in the<P>
|
|
current environment, the one in which the <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> form was evaluated.<P>
|
|
<P>
|
|
The same considerations apply to <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A>.<P>
|
|
<P>
|
|
<B>Proposal (STEP-ENVIRONMENT:CURRENT):<P>
|
|
</B> <P>
|
|
1. Clarify that <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> and <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A> evaluate the form in the current environment.<P>
|
|
<P>
|
|
2. Clarify that calls to both <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> and <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A> may be compiled, but that<P>
|
|
in the case of <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A>, it is acceptable for an implementation to<P>
|
|
interactively step through only those parts of the computation that are<P>
|
|
interpreted.<P>
|
|
<P>
|
|
<B>Examples:<P>
|
|
</B> <P>
|
|
;Assuming X is not a special variable<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_setq.htm#setq"><B>setq</B></A> x 1)<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((x 2))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>step</B></A> (<A REL=DEFINITION HREF="../Body/f_wr_pr.htm#print"><B>print</B></A> x)))<P>
|
|
<P>
|
|
This should print and return 2, not 1, when interpreted.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B> <P>
|
|
1. It is more useful for the lexical environment to pass transparently<P>
|
|
through <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> and <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A> than to reset to the null environment.<P>
|
|
<P>
|
|
2. Although <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> is primarily a debugging tool, there is no reason to<P>
|
|
prevent it from being compiled correctly.<P>
|
|
<P>
|
|
<B>Current practice:<P>
|
|
</B><P>
|
|
Vax Lisp behaves as proposed. Symbolics Common Lisp treats <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> as a special <P>
|
|
form and does not allow it to be compiled. <P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B> <P>
|
|
Minimal.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B> <P>
|
|
None.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B> <P>
|
|
These debugging tools will continue to have vague specifications.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B> <P>
|
|
Slightly more preicse specification of Common Lisp.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B> <P>
|
|
Slightly improved.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B> <P>
|
|
There was some discussion of separating this out into two separate<P>
|
|
proposals, but it didn't seem useful.<P>
|
|
<P>
|
|
Eric Benson contributed the definition of <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A> in Lucid Common Lisp:<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmac.htm#defmacro"><B>defmacro</B></A> <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>time</B></A> (form)<P>
|
|
`(time-internal #'(<A REL=DEFINITION HREF="../Body/a_lambda.htm#lambda"><B>lambda</B></A> () ,form)))<P>
|
|
<P>
|
|
<P>
|
|
The function TIME-INTERNAL looks something like:<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defun.htm#defun"><B>defun</B></A> time-internal (thunk)<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((before-time (get-time-state)))<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_unwind.htm#unwind-protect"><B>unwind-protect</B></A><P>
|
|
(<A REL=DEFINITION HREF="../Body/f_funcal.htm#funcall"><B>funcall</B></A> thunk)<P>
|
|
(print-time-information before-time (get-time-state)))))<P>
|
|
<P>
|
|
The definition of <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> is similar. This is just to show that it is<P>
|
|
easy to get the right lexical environment even though <A REL=DEFINITION HREF="../Body/m_time.htm#time"><B>TIME</B></A> and <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A><P>
|
|
are macros.<P>
|
|
<P>
|
|
VaxLisp expands <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> into something like:<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmac.htm#defmacro"><B>defmacro</B></A> <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>step</B></A> (form)<P>
|
|
`(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((*eval-hook* #'step-command-loop))<P>
|
|
,form))<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
Additional comments:<P>
|
|
<P>
|
|
Verbally this was explained to mean that the body of the <A REL=DEFINITION HREF="../Body/m_step.htm#step"><B>STEP</B></A> would<P>
|
|
not be stepped when compiled, but if it just happened to call an<P>
|
|
interpreted function, that function would get stepped.<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>
|