From: Jerry Boetje on
I was just delving into implementation of declarations in CLforJava,
and I came into an interesting situation. Here's the situation...

(defun foo (a)
(declare (fixnum a))
(declare ((integer 0 16) a))
...)

Should I pick one (the larger or the smaller) or should I attempt to
intersect these declarations?

I tried this in LW, and it seemed to prefer the FIXNUM over the
(integer 0 16). The order of the declares don't make a different. What
are your opinions?
From: Pascal J. Bourguignon on
Jerry Boetje <jerryboetje(a)mac.com> writes:

> I was just delving into implementation of declarations in CLforJava,
> and I came into an interesting situation. Here's the situation...
>
> (defun foo (a)
> (declare (fixnum a))
> (declare ((integer 0 16) a))
> ...)
>
> Should I pick one (the larger or the smaller) or should I attempt to
> intersect these declarations?
>
> I tried this in LW, and it seemed to prefer the FIXNUM over the
> (integer 0 16). The order of the declares don't make a different. What
> are your opinions?

The intersection seems to be the right semantics.

But the choice is really yours, as an implementer, since it's
implementation specific what is done with type declarations.

If you have a sophisticated type engine, then it will be beneficial to
use the intersection. If you're doing just the minimum typing to match
Java types, then anything matching one of those can be choose
(ie. fixnum which may be a int16 could do).


--
__Pascal Bourguignon__
From: Duane Rettig on
On Feb 23, 3:34 pm, Jerry Boetje <jerryboe...(a)mac.com> wrote:
> I was just delving into implementation of declarations in CLforJava,
> and I came into an interesting situation. Here's the situation...
>
>   (defun foo (a)
>     (declare (fixnum a))
>     (declare ((integer 0 16) a))
>       ...)
>
> Should I pick one (the larger or the smaller) or should I attempt to
> intersect these declarations?

Declarations are promises to keep. So if both promises are to be
kept, then the program can count on the intersection to be the case.

Duane