[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue: DECLARE-TYPE-FREE (Version 1)



re: >  (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)))))

    Gag!  This is an example of what we most definitely want to prohibit.
    This is a highly misguided programming style and can be made meaningful
    only if the compiler is prohibited from using specialized storage for
    variables.


Right!  You've put it very well.  However, not everyone is aware of the 
compiler techniques for "using specialized storage" to good advantage.  I 
doubt seriously whether the Symbolics lisp compiler would be concerned with 
these questions, since it is reputed to ignore all type declarations anyway.
[I wonder if the CLOE treatment is significantly more advanced.]

Does the TI compiler do any of "these techniques"?  Of course, Lucid
does something like PDP10 MacLisp did for certain numeric types, and
I'm sure that is why CLtL p158 has such an odd restriction on the
scope of type declarations -- i.e., to hinder just such gross programs
as the one you gagged upon above.


-- JonL -