163 lines
8.7 KiB
HTML
163 lines
8.7 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 GENERIC-FLET-POORLY-DESIGNED 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/iss180_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss181.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss182_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/iss180_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss181.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss182_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue GENERIC-FLET-POORLY-DESIGNED Writeup</H2>
|
|
|
|
<PRE><B>Status:</B> Proposal <A REL=DEFINITION HREF="../Body/f_rm_rm.htm#delete"><B>DELETE</B></A> accepted 12/91<P>
|
|
<B>Issue:</B> <A HREF="iss181.htm">GENERIC-FLET-POORLY-DESIGNED</A><P>
|
|
<B>References:</B> CLtL2 p.844-846<P>
|
|
Related issues: <A HREF="iss359.htm">WITH-ADDED-METHODS</A><P>
|
|
<B>Category:</B> CHANGE<P>
|
|
<B>Edit history:</B> 22-Aug-91, Version 1 by Barmar<P>
|
|
10-Sep-91, Version 2 by Barmar - minor RPG-suggested<P>
|
|
changes<P>
|
|
10-Jan-92, Version 3 by Barrett - remove <A REL=DEFINITION HREF="../Body/t_generi.htm#generic-function"><B>GENERIC-FUNCTION</B></A>,<P>
|
|
per X3J13 ammendment<P>
|
|
10-Feb-92, Version 4 by Barrett - put back <A REL=DEFINITION HREF="../Body/t_generi.htm#generic-function"><B>GENERIC-FUNCTION</B></A><P>
|
|
symbol mistakenly removed; fix Current practice<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
Very few, if any, CLOS implemementations implement GENERIC-FLET and<P>
|
|
GENERIC-LABELS.<P>
|
|
<P>
|
|
<B>Proposal (GENERIC-FLET-POORLY-DESIGNED:DELETE):<P>
|
|
</B><P>
|
|
Remove the operators GENERIC-FLET, GENERIC-LABELS, and <A REL=DEFINITION HREF="../Body/t_generi.htm#generic-function"><B>GENERIC-FUNCTION</B></A> from<P>
|
|
the language. Delete the symbols GENERIC-FLET and GENERIC-LABELS from the<P>
|
|
COMMON-LISP package.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
The current form of lexical generic functiona is inadequate for<P>
|
|
general use, and therefore there is no existing compelling reason to<P>
|
|
retain them. Because they are poorly designed, it would be better to<P>
|
|
remove them from the language hoping for research and better designs<P>
|
|
than to prejudice the case for them by retaining a bad design.<P>
|
|
<P>
|
|
The symbol <A REL=DEFINITION HREF="../Body/t_generi.htm#generic-function"><B>GENERIC-FUNCTION</B></A> is retained because it also names a <A REL=DEFINITION HREF="../Body/t_class.htm#class"><B>class</B></A>.<P>
|
|
<P>
|
|
<B>Current practice:<P>
|
|
</B><P>
|
|
Apple Macintosh Common Lisp 2.0 provides the listed operators.<P>
|
|
<P>
|
|
Lucid CL 4.0 and Symbolics Genera 8.1 both <A REL=DEFINITION HREF="../Body/f_export.htm#export"><B>export</B></A> GENERIC-FLET and<P>
|
|
GENERIC-LABELS from their CLOS packages, and Lucid imports it into<P>
|
|
the implementation-dependent package that USER inherits from. Neither<P>
|
|
of them defines them, though.<P>
|
|
<P>
|
|
Preliminary Symbolics Genera 8.2 and Chesnut Lisp-to-C Translator 2.0<P>
|
|
provided the listed operators at the time of the December meeting. Since<P>
|
|
then they have deleted from both implementations, in deference to the<P>
|
|
committee's decision.<P>
|
|
<P>
|
|
Symbolics CLOE does not <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> them.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Very little. For many implementors, no work at all is involved.<P>
|
|
Any implementors that <A REL=DEFINITION HREF="../Body/f_export.htm#export"><B>export</B></A> these symbols from COMMON-LISP will have<P>
|
|
to change their package specification, but that's it.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Since this is a new feature that not everyone implements, programs<P>
|
|
that use them are not currently portable, so there should be little<P>
|
|
effect on users.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
It will probably take longer for complete CLOS implementations to<P>
|
|
appear.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
See Esthetics and Cost of non-adoption.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Since no one really understands what these special forms are for, this<P>
|
|
clearly simplifies the language.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
From RPG:<P>
|
|
<P>
|
|
The reason that lexical generic functions are relatively less useful<P>
|
|
than lexical functions is that with a generic function you are<P>
|
|
expecting that someone will extend it when they extend the ontology of<P>
|
|
the world, and you want to get a hold of those extensions for free.<P>
|
|
The mechanism for the for-freeness is the global namespace for generic<P>
|
|
function names. When you make those names lexical you lose this<P>
|
|
feature. Presumably this is the primary nice feature of OOP.<P>
|
|
<P>
|
|
The use of lexical generic functions is to create private operations<P>
|
|
within a scope, which can be larger than the scope of a function. The<P>
|
|
purpose of generic-flet/labels is to allow folks to write these<P>
|
|
private functions. The point of <A HREF="iss359.htm">with-added-methods</A> was to allow these<P>
|
|
local functions to be extended within the larger lexical scope. <P>
|
|
<P>
|
|
<A HREF="iss359.htm">With-added-methods</A> had the flaw that it did not allow one to extend a<P>
|
|
global generic function within its dynamic extent, which I believe was<P>
|
|
the intent of its proposer. That is, it couldn't be used to add a<P>
|
|
<A REL=DEFINITION HREF="../Body/t_method.htm#method"><B>method</B></A> to a generic version of print such that that extended version<P>
|
|
would be used by all free references to it dynamically within the<P>
|
|
extent of the <A HREF="iss359.htm">with-added-methods</A>.<P>
|
|
<P>
|
|
Still, it had a use within the scenario I outlined above.<P>
|
|
<P>
|
|
The real flaw with the whole design is that one would like to have<P>
|
|
lexical <A REL=DEFINITION HREF="../Body/t_class.htm#class"><B>class</B></A> definitions, which would render lexical generic<P>
|
|
functions more useful, because then the lexical environments <A REL=DEFINITION HREF="../Body/f_provid.htm#provide"><B>provide</B></A> a<P>
|
|
possible worlds mechanism. So, one would like to create an environment<P>
|
|
with a locally extended hierarchy within which the lexical generic<P>
|
|
functions are used.<P>
|
|
<P>
|
|
A minor flaw with lexical generic functions are specified is their<P>
|
|
stupid syntax. If I were in a catty mood, I would ascribe the bad<P>
|
|
syntax.<P>
|
|
<P>
|
|
I believe there are a number of other operations one would like to<P>
|
|
perform with generic functions that are now not possible, such as<P>
|
|
explicitly combining separately defined generic functions. This along<P>
|
|
with lexical generic functions would allow people to do<P>
|
|
encapsulation. But that's another story.<P>
|
|
<P>
|
|
Right now I would advocate removing lexical generic functions so that<P>
|
|
someone can do a proper design.<P>
|
|
<P>
|
|
Barmar:<P>
|
|
<P>
|
|
What about GENERIC-FUNCTION? If lexical generic functions are<P>
|
|
useless, maybe anonymous ones are as well.<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>
|