111 lines
5.3 KiB
HTML
111 lines
5.3 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 STRUCTURE-READ-PRINT-SYNTAX 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/iss330_w.htm">
|
|
<LINK REL=UP HREF="../Issues/iss331.htm">
|
|
<LINK REL=NEXT HREF="../Issues/iss332_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/iss330_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="../Issues/iss331.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="../Issues/iss332_w.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
|
|
|
|
<H2>Issue STRUCTURE-READ-PRINT-SYNTAX Writeup</H2>
|
|
|
|
<PRE><B>Issue:</B> <A HREF="iss331.htm">STRUCTURE-READ-PRINT-SYNTAX</A><P>
|
|
<B>References:</B> <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A><P>
|
|
Related issues: Issue <A HREF="iss119.htm">DEFSTRUCT-SLOTS-CONSTRAINTS-NAME</A><P>
|
|
<B>Category:</B> CHANGE<P>
|
|
<B>Edit history:</B> V1, 11 May 90, Sandra Loosemore<P>
|
|
V2, 29 May 90, Sandra Loosemore (cross-references)<P>
|
|
<P>
|
|
<P>
|
|
<B>Problem description:<P>
|
|
</B><P>
|
|
The use of non-keywords for slot names in #S reader/printer<P>
|
|
syntax is ugly. The <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> ought to encourage a cleaner<P>
|
|
style.<P>
|
|
<P>
|
|
<B>Proposal (STRUCTURE-READ-PRINT-SYNTAX:KEYWORDS):<P>
|
|
</B><P>
|
|
(1) Deprecate the use of non-keywords to name slots in #S syntax<P>
|
|
for reading structures.<P>
|
|
<P>
|
|
(2) Require that #S syntax for printing structures print slot<P>
|
|
names as keywords.<P>
|
|
<P>
|
|
<B>Rationale:<P>
|
|
</B><P>
|
|
This encourages a cleaner style while maintaining backward<P>
|
|
compatibility for users.<P>
|
|
<P>
|
|
<B>Current Practice:<P>
|
|
</B><P>
|
|
Some implementations already use keywords for printing<P>
|
|
structures, while some use unqualified symbols. Practice among<P>
|
|
users is also mixed. Many users tend to follow the example of<P>
|
|
whatever implementation they use most frequently.<P>
|
|
<P>
|
|
<B>Cost to Implementors:<P>
|
|
</B><P>
|
|
The actual implementation cost of changing the #S printer <P>
|
|
is trivial, but there may be more work involved in updating <P>
|
|
documentation.<P>
|
|
<P>
|
|
<B>Cost to Users:<P>
|
|
</B><P>
|
|
None.<P>
|
|
<P>
|
|
<B>Cost of non-adoption:<P>
|
|
</B><P>
|
|
See "esthetics".<P>
|
|
<P>
|
|
<B>Performance impact:<P>
|
|
</B><P>
|
|
Using keywords is probably slightly more efficient than using<P>
|
|
unqualified symbols, at least on the reader end.<P>
|
|
<P>
|
|
<B>Benefits:<P>
|
|
</B><P>
|
|
See "esthetics".<P>
|
|
<P>
|
|
<B>Esthetics:<P>
|
|
</B><P>
|
|
The use of non-keywords to name slots in #s syntax is ugly.<P>
|
|
Technically, there is no reason now why both users and<P>
|
|
implementors cannot use keywords, but the fact that CLtL<P>
|
|
goes out of its way to explain that it's not necessary to<P>
|
|
do so, and that all of the examples of #s syntax use non-keywords, <P>
|
|
has encouraged both users and implementors to follow this style.<P>
|
|
<P>
|
|
<B>Discussion:<P>
|
|
</B><P>
|
|
Proposal <A HREF="iss119.htm">DEFSTRUCT-SLOTS-CONSTRAINTS-NAME:DUPLICATES-ERROR</A> made<P>
|
|
it clear that <A REL=DEFINITION HREF="../Body/m_defstr.htm#defstruct"><B>DEFSTRUCT</B></A> slot names must have unique<P>
|
|
symbol-names. Therefore there is no possibility for conflicts<P>
|
|
if the slot names are printed as keyword symbols.<P>
|
|
<P>
|
|
Several people have voiced support for at least changing the<P>
|
|
examples in the <A REL=DEFINITION HREF="../Body/07_ffb.htm#standard"><B>standard</B></A> to use keywords, to encourage both<P>
|
|
users and implementors to adopt the style.<P>
|
|
<P>
|
|
Dan Pierson says:<P>
|
|
Yes, YEs, YES! I've been wanting this fix for bogus implementations<P>
|
|
since CLtL came out and ******lisp interpreted it the other way.<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>
|