[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue: DECLARE-TYPE-FREE (Version 1)
- To: Gray@DSG.csc.ti.com, Moon@STONY-BROOK.SCRC.Symbolics.COM
- Subject: Re: Issue: DECLARE-TYPE-FREE (Version 1)
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Wed, 21 Sep 88 12:21 EDT
- Cc: CL-Cleanup@SAIL.STANFORD.EDU
- In-reply-to: <2799849365-13670868@Kelvin>
Date: Wed, 21 Sep 88 10:56:05 CDT
From: David N Gray <Gray@DSG.csc.ti.com>
> Should add that if there is both a binding declaration and a local
> declaration for the type of the same variable, then, within the scope of
> the local declaration, it is an error for the variable to contain a value
> which is not a member of the intersection of the two types. (This implies
> that it would be desirable for the compiler to complain if the two types
> are disjoint.)
>
> True. Does the proposal really need to say this? It's a pretty obvious
> consequence.
It may be obvious to us, but it probably wouldn't be to the average user.
Anyway, I had to stop and think about whether it should be a subtype or
just non-disjoint. ...
Well, it just occurred to me that there is an interpretation to even a disjoint
type declaration. Consider that the paranoid programmer might try to help out
the compiler's storage allocation phase by recycling a variable for a new type
using SETQ because he knows it won't be used further in the program but doesn't
know for sure that the compiler will realize this fact. Here's an example of
that style:
(DEFUN FOO (X Y)
(DECLARE (FLOAT X Y))
(LET ((SUM (+ X Y)))
(DECLARE (FLOAT SUM))
(COND ((> SUM 3.0)
(LOCALLY (DECLARE (FIXNUM X))
; X won't be used any more, so let's recycle its home...
(SETQ X (TRUNCATE SUM))
(+ (* X X) (* SUM Y))))
(T
(* X Y SUM)))))