176 lines
11 KiB
HTML
176 lines
11 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 METHOD-INITFORM 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/iss242_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss243.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss244_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/iss242_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss243.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss244_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue METHOD-INITFORM Writeup</H2>
|
|
|
|
<PRE>Date: Fri, 8 Jun 90 20:00 EDT<P>
|
|
From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM><P>
|
|
Subject: Issue: <A HREF="iss243.htm">METHOD-INITFORM</A> (Version 5)<P>
|
|
To: X3J13@mcc.com<P>
|
|
Message-ID: <19900609000021.5.MOON@KENNETH-WILLIAMS.SCRC.Symbolics.COM><P>
|
|
<P>
|
|
This version contains the corrections to current practice noted at<P>
|
|
the X3J13 meeting today.<P>
|
|
<P>
|
|
METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD failed 0-11<P>
|
|
<A HREF="iss243.htm">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</A> passed 13-0<P>
|
|
<P>
|
|
<B>Issue:</B> <A HREF="iss243.htm">METHOD-INITFORM</A><P>
|
|
<P>
|
|
<B>References:</B> 88-002R p.2-12<P>
|
|
<P>
|
|
<B>Category:</B> CLARIFICATION<P>
|
|
<P>
|
|
<B>Edit history:</B> 29-Apr-90, Version 1 by Moon<P>
|
|
30-Apr-90, Version 2 by Moon (update current practice)<P>
|
|
4-May-90, Version 3 by Moon (update discussion and current<P>
|
|
practice)<P>
|
|
5-Jun-90, Version 4 by Moon (update current practice)<P>
|
|
8-Jun-90, Version 5 by Moon (update current practice)<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
Should <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A> and <A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A> be allowed in initforms for<P>
|
|
optional and keyword parameters and <A REL=DEFINITION HREF="../Body/03_da.htm#AMaux"><B>&AUX</B></A> variables of methods? The<P>
|
|
document currently allows them only in the body of a <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>, not in forms<P>
|
|
embedded in the lambda-list, although it takes a close reading of the<P>
|
|
document to discern this.<P>
|
|
<P>
|
|
There are two proposals in this issue.<P>
|
|
<P>
|
|
This is Symbolics issue #15.<P>
|
|
<P>
|
|
<B>Proposal (METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD):<P>
|
|
</B><P>
|
|
Expand the lexical scope of <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A> and <A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A> to include<P>
|
|
all forms in a <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>, including forms embedded in the lambda-list.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
This seems more natural and consistent.<P>
|
|
<P>
|
|
<B>Proposal (METHOD-INITFORM:FORBID-CALL-NEXT-METHOD):<P>
|
|
</B> <P>
|
|
The lexical scope of <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A> and <A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A> includes only<P>
|
|
forms in the body of a <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
This is the status quo and is easier to implement.<P>
|
|
<P>
|
|
<B>Examples:<P>
|
|
</B><P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>defmethod</B></A> foo ((x myclass) <A REL=DEFINITION HREF="../Body/03_da.htm#AMaux"><B>&aux</B></A> (y (<A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>call-next-method</B></A>)))<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_if.htm#if"><B>if</B></A> (<A REL=DEFINITION HREF="../Body/a_null.htm#null"><B>null</B></A> y)<P>
|
|
(zzz)<P>
|
|
(<A REL=DEFINITION HREF="../Body/a_list.htm#list"><B>list</B></A> ':baz y)))<P>
|
|
;is briefer than<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>defmethod</B></A> foo ((x myclass))<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((y (<A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>call-next-method</B></A>)))<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_if.htm#if"><B>if</B></A> (<A REL=DEFINITION HREF="../Body/a_null.htm#null"><B>null</B></A> y)<P>
|
|
(zzz)<P>
|
|
(<A REL=DEFINITION HREF="../Body/a_list.htm#list"><B>list</B></A> ':baz y))))<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>defmethod</B></A> countem ((x myclass) <A REL=DEFINITION HREF="../Body/03_da.htm#AMoptional"><B>&optional</B></A> (local (<A REL=DEFINITION HREF="../Body/a_not.htm#not"><B>not</B></A> (<A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>next-method-p</B></A>))))<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((accum (<A REL=DEFINITION HREF="../Body/s_if.htm#if"><B>if</B></A> local 0 (<A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>call-next-method</B></A>))))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_dolist.htm#dolist"><B>dolist</B></A> (y (frobs x))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_incf_.htm#incf"><B>incf</B></A> accum y))<P>
|
|
accum))<P>
|
|
;is briefer than<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>defmethod</B></A> countem ((x myclass) <A REL=DEFINITION HREF="../Body/03_da.htm#AMoptional"><B>&optional</B></A> (local <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>nil</B></A> local-p))<P>
|
|
(<A REL=DEFINITION HREF="../Body/s_let_l.htm#let"><B>let</B></A> ((accum (<A REL=DEFINITION HREF="../Body/s_if.htm#if"><B>if</B></A> (<A REL=DEFINITION HREF="../Body/s_if.htm#if"><B>if</B></A> local-p local (<A REL=DEFINITION HREF="../Body/a_not.htm#not"><B>not</B></A> (<A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>next-method-p</B></A>)))<P>
|
|
0 (<A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>call-next-method</B></A>))))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_dolist.htm#dolist"><B>dolist</B></A> (y (frobs x))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_incf_.htm#incf"><B>incf</B></A> accum y))<P>
|
|
accum))<P>
|
|
<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>defmethod</B></A> jack-of-confusion ((x myclass))<P>
|
|
(<A REL=DEFINITION HREF="../Body/m_defmet.htm#defmethod"><B>defmethod</B></A> ace-of-confusion ((x myclass)<P>
|
|
<A REL=DEFINITION HREF="../Body/03_da.htm#AMoptional"><B>&optional</B></A> (y (<A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>call-next-method</B></A>)))<P>
|
|
(borf x y))<P>
|
|
(ace-of-confusion x))<P>
|
|
;In METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD, the default value for y<P>
|
|
;is the value returned by an ace-of-confusion <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>.<P>
|
|
;In <A HREF="iss243.htm">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</A>, the default value for y<P>
|
|
;is the value returned by a jack-of-confusion <A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A>.<P>
|
|
<P>
|
|
<B>Current practice:<P>
|
|
</B><P>
|
|
Symbolics Genera 8.0, Lucid 4.0.0 Beta-1, and recent versions of<P>
|
|
PCL appear to implement METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD.<P>
|
|
TI Explorer release 6 does not.<P>
|
|
Apple and IIM implement <A HREF="iss243.htm">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</A>.<P>
|
|
<P>
|
|
The first example does not actually work in Genera due to a bug.<P>
|
|
<P>
|
|
Other CLOS implementations were not surveyed.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
In METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD, handling <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A> and<P>
|
|
<A REL=DEFINITION HREF="../Body/f_next_m.htm#next-method-p"><B>NEXT-METHOD-P</B></A> by simply wrapping a <A REL=DEFINITION HREF="../Body/s_flet_.htm#flet"><B>FLET</B></A> or <A REL=DEFINITION HREF="../Body/s_flet_.htm#macrolet"><B>MACROLET</B></A> around the body will<P>
|
|
not work. If they are called from forms in the lambda-list some<P>
|
|
massaging of the lambda-list is necessary. It's not very difficult,<P>
|
|
though.<P>
|
|
<P>
|
|
<A HREF="iss243.htm">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</A> has no cost to implementors.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
None for either proposal.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
<A HREF="iss243.htm">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</A> forbids a programming technique<P>
|
|
that users might find useful. METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD<P>
|
|
requires a little more work for implementors, who might have thought<P>
|
|
they had finished their CLOS implementations by now.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
<A HREF="iss243.htm">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</A> avoids changing the status quo.<P>
|
|
METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD provides a programming technique<P>
|
|
that users might find useful.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
METHOD-INITFORM:ALLOW-CALL-NEXT-METHOD seems more uniform.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Jeff Dalton suggests that the places where <A REL=DEFINITION HREF="../Body/f_call_n.htm#call-next-method"><B>CALL-NEXT-METHOD</B></A> is allowed<P>
|
|
should be consistent with the places where <A REL=DEFINITION HREF="../Body/m_return.htm#return"><B>RETURN</B></A> from an implicit block<P>
|
|
is allowed. This probably supports FORBID-CALL-NEXT-METHOD.<P>
|
|
<P>
|
|
Gregor Kiczales says he supports FORBID-CALL-NEXT-METHOD, but is not<P>
|
|
adamant about it. He thinks FORBID-CALL-NEXT-METHOD is more natural.<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>
|