[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue: DECLARE-TYPE-FREE (Version 9)
- To: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
- Subject: Re: Issue: DECLARE-TYPE-FREE (Version 9)
- From: masinter.pa@Xerox.COM
- Date: 2 Jan 89 22:12 PST
- Cc: CL-Cleanup@sail.stanford.edu
- In-reply-to: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>'s message of Mon, 2 Jan 89 19:32 EST
Thanks for doing this, I think it does help clarify the discussion.
I had thought -- apparently incorrectly -- that the only objection to
making type declarations have the strongest possible meaning was the
difficulty in specifying what that meaning might be. I think the ALLOW
proposal does so consistently.
If I say (DECLARE (TYPE (SIGNED-BYTE 12) X)), I'd think I'd like it to mean
that X never even momentarily holds a value that isn't of the declared
I'd suggest adding to Current Practice that some Common Lisp
implementations ignore type declarations completely.
I'd like to see the writeup make it clear that the following is subsumed;
note that this issue never was released or appeared on a Status list, so it
should probably just be included
Received: from SAIL.Stanford.EDU ([18.104.22.168]) by Xerox.COM ; 04 NOV 88
Received: from ti.com by SAIL.Stanford.EDU with TCP; 4 Nov 88 16:19:26 PST
Received: by ti.com id AA07547; Fri, 4 Nov 88 18:19:48 CST
Received: from Kelvin by tilde id AA15412; Fri, 4 Nov 88 18:03:33 CST
Date: Fri, 4 Nov 88 18:05:21 CST
From: David N Gray <Gray@DSG.csc.ti.com>
Subject: Issue SPECIAL-TYPE-SHADOWING (V1)
In-Reply-To: Msg of 28 Sep 88 20:44 PDT from masinter.pa@Xerox.COM
References: CLtL pages 156, 158
Related issues: DECLARE-TYPE-FREE
Edit history: Version 1, 04-Nov-88 by David Gray
A Common Lisp user raised the question of whether something like the
following is legal:
(PROCLAIM '(TYPE NUMBER *X*))
(DEFUN FOO ()
(LET ((*X* T))
(DECLARE (TYPE SYMBOL *X*))
Page 156 of CLtL says that a proclamation is "always in force unless
locally shadowed" and page 158 says type declarations "only affect
variable bindings", which might be interpreted to mean that the DECLARE
locally shadows the PROCLAIM. However, that interpretation would make
the global type proclamation useless because it could not be relied on
when compiling a function such as BAR.
Clarify that if there is a local type declaration for a special
variable, and there is also a global type proclamation for that same
variable, then the value of the variable within the scope of the local
declaration must be a member of the intersection of the two declared
Some restriction on local type declarations for special variables is
needed in order for type proclamations to be meaningful. The wording
used here was chosen for consistency with proposal DECLARE-TYPE-FREE.
The TI, Symbolics, and Lucid implementations do not report any error
on the example above, but it isn't clear that they really do anything
with type declarations for special variables anyway.
Cost to Implementors:
This is unlikely to require a change in any current implementation.
Cost to Users:
Anyone who has written code like the example above would have to
modify it if compilers started enforcing this restriction.
Cost of non-adoption:
A minor ambiguity in the language specification that could confuse
A clearer definition of the meaning of type declarations for special
This is obviously very closely related to issue DECLARE-TYPE-FREE, but
this is an ambiguity in the existing language that should be resolved
even if the language extension of proposal DECLARE-TYPE-FREE is not
accepted. Note also that DECLARE-TYPE-FREE makes no mention of type
Other possible resolutions of the ambiguity would be to either rule
out use of local type declarations for special variables, or to say
that the local type must be a subtype of the global type.