125 lines
7.4 KiB
HTML
125 lines
7.4 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 SUBTYPEP-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/iss333_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss334.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss335_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/iss333_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss334.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss335_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue SUBTYPEP-ENVIRONMENT Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss334.htm">SUBTYPEP-ENVIRONMENT</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_deftp.htm#deftype"><B>DEFTYPE</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/f_typep.htm#typep"><B>TYPEP</B></A>, <A REL=DEFINITION HREF="../Body/f_subtpp.htm#subtypep"><B>SUBTYPEP</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/f_upgr_1.htm#upgraded-array-element-type"><B>UPGRADED-ARRAY-ELEMENT-TYPE</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/f_upgrad.htm#upgraded-complex-part-type"><B>UPGRADED-COMPLEX-PART-TYPE</B></A><P>
|
|
Related issues: Issue <A HREF="iss059.htm">COMPILE-FILE-HANDLING-OF-TOP-LEVEL-FORMS</A><P>
|
|
Issue <A HREF="iss051.htm">CLOS-MACRO-COMPILATION</A><P>
|
|
Issue <A HREF="iss121.htm">DEFTYPE-DESTRUCTURING</A><P>
|
|
Issue <A HREF="iss085.htm">CONSTANTP-ENVIRONMENT</A><P>
|
|
<B>Category:</B> CHANGE, ADDITION<P>
|
|
<B>Edit history:</B> V1, 02 Jan 1989, ???<P>
|
|
V2, 12 Feb 1991, Sandra Loosemore<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
Defining macros including <A REL=DEFINITION HREF="../Body/m_deftp.htm#deftype"><B>DEFTYPE</B></A>, <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A>, <A REL=DEFINITION HREF="../Body/m_defcla.htm#defclass"><B>DEFCLASS</B></A>, and<P>
|
|
<A REL=DEFINITION HREF="../Body/m_defi_5.htm#define-condition"><B>DEFINE-CONDITION</B></A> are permitted to note type definitions at<P>
|
|
compile-time in such a way that those definitions are visible only to<P>
|
|
the file compiler and not to the evaluator. This can lead to<P>
|
|
incorrect behavior in user code that deals with the type system, for<P>
|
|
example in macro expansion functions. Such code needs to explicitly<P>
|
|
indicate in some way whether it wishes to deal with the type system as<P>
|
|
seen by the file compiler (the "remote environment"), or in the <P>
|
|
current environment.<P>
|
|
<P>
|
|
<B>Proposal (SUBTYPEP-ENVIRONMENT:ADD-ARG):<P>
|
|
</B><P>
|
|
Add an optional environment argument to <A REL=DEFINITION HREF="../Body/f_typep.htm#typep"><B>TYPEP</B></A>, <A REL=DEFINITION HREF="../Body/f_subtpp.htm#subtypep"><B>SUBTYPEP</B></A>,<P>
|
|
<A REL=DEFINITION HREF="../Body/f_upgr_1.htm#upgraded-array-element-type"><B>UPGRADED-ARRAY-ELEMENT-TYPE</B></A>, and <A REL=DEFINITION HREF="../Body/f_upgrad.htm#upgraded-complex-part-type"><B>UPGRADED-COMPLEX-PART-TYPE</B></A>. If the<P>
|
|
argument is <A REL=DEFINITION HREF="../Body/a_nil.htm#nil"><B>NIL</B></A> or not supplied, it defaults to the null lexical<P>
|
|
environment and current global environment.<P>
|
|
<P>
|
|
Clarify that <A REL=DEFINITION HREF="../Body/03_dd.htm#AMenvironment"><B>&ENVIRONMENT</B></A> may appear in the lambda-list of a <A REL=DEFINITION HREF="../Body/m_deftp.htm#deftype"><B>DEFTYPE</B></A> <P>
|
|
form, as with <A REL=DEFINITION HREF="../Body/m_defmac.htm#defmacro"><B>DEFMACRO</B></A>.<P>
|
|
<P>
|
|
<B>Examples:<P>
|
|
</B><P>
|
|
???<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
This is consistent with the mechanism used elsewhere to specify what<P>
|
|
environment name/definition lookups should be performed in.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Chestnut's Lisp-to-C translator supports this mechanism.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
Minor. Implementations that don't support the notion of "remote<P>
|
|
environments" can ignore the environment arguments.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
Minor. Users may have to be more careful about passing environment<P>
|
|
arguments around.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
Programs that try to manipulate type information at compile-time will<P>
|
|
break in some implementations.<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
Minor.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
The cost of non-adoption is avoided.<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
Looks OK to me.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Version 1 of this issue was lost. Version 2 is a completely new<P>
|
|
writeup.<P>
|
|
<P>
|
|
Loosemore and Barrett support this proposal.<P>
|
|
<P>
|
|
There may be confusion about why <A REL=DEFINITION HREF="../Body/f_tp_of.htm#type-of"><B>TYPE-OF</B></A> does not need an<P>
|
|
environment argument. Recall that compile-time type definitions made<P>
|
|
by <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A>, <A REL=DEFINITION HREF="../Body/m_defcla.htm#defclass"><B>DEFCLASS</B></A>, and <A REL=DEFINITION HREF="../Body/m_defi_5.htm#define-condition"><B>DEFINE-CONDITION</B></A> are permitted to be<P>
|
|
partial or incomplete. Essentially, the only information that is<P>
|
|
required at compile-time is that a name/type mapping exists and the<P>
|
|
subtype/supertype relationships between all of the type specifiers.<P>
|
|
On the other hand, the type must be fully defined before instances can<P>
|
|
be created. If no instances can be created, then <A REL=DEFINITION HREF="../Body/f_tp_of.htm#type-of"><B>TYPE-OF</B></A> has no need<P>
|
|
to know about the type. <A REL=DEFINITION HREF="../Body/f_tp_of.htm#type-of"><B>TYPE-OF</B></A> also has no need to know about type<P>
|
|
specifiers defined with <A REL=DEFINITION HREF="../Body/m_deftp.htm#deftype"><B>DEFTYPE</B></A>.<P>
|
|
<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>
|