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

Re: Issue: DECLARE-TYPE-FREE (Version 1)



>     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.

> I don't understand why you think local declarations forbid specialized
> representations (within the scope of the declaration)

It doesn't forbid it, but in order to do it, the compiler would have to
copy the value, but it can only do that if it knows that it is not SETQ'd.
It also would require the compiler to count the number of references to
decide if the copy is worthwhile.  Thus, while it would be possible for a
compiler to do this, it is unlikely for an implementor to go to that much
trouble.

> It seems to me that a type declaration provides some information to the compiler,
> and what the compiler does with it is not really the business of the Common Lisp
> language specification

Assuming of course that the information is really useful to a compiler;
there wouldn't be much point otherwise.