[cdr-discuss] CDR 5

Marco Antoniotti marcoxa at cs.nyu.edu
Sat Mar 1 18:06:17 UTC 2008


On Mar 1, 2008, at 14:21 , Nikodemus Siivola wrote:

> On 2/29/08, Marco Antoniotti <marcoxa at cs.nyu.edu> wrote:
>
>>  There is no stating in the ANSI spec that ARRAY-DIMENSION-LIMIT =  
>> or /
>>  = or < or <= ARRAY-TOTAL-SIZE-LIMIT.  AFAIU, the latter is  
>> guaranteed
>>  to be the maximum number of elements in an array as per the glossary
>>  entry about "array total size" (always implementation dependent).
>
>> From the ARRAY-TOTAL-SIZE-LIMIT dictionary entry:
>
> "The actual limit on the array total size imposed by the
> implementation might vary according the element type of the array; in
> this case, the value of array-total-size-limit will be the smallest of
> these possible limits."
>
> which IMO makes it unsuitable for this type. ARRAY-DIMENSION-LIMIT
> OTOH doesn't carry these weasel-words, which in my interpretation
> means that it is the greatest of the possible limits.

Well, this is why using A-T-S-L is the most conservative choice.    
The main difference is in the glossary entry for array total size.

> (But the distinction is somewhat academic, I grant you. In eg. SBCL
> both A-D-L and A-T-S-L are MOST-POSITIVE-FIXNUM, though arguably at
> least A-T-S-L should be smaller then that.)

Yes.   Maybe, the index type should be parametric on the element type.

>>  The real issue I am not sure about is whether to include or not the
>>  limit.  It has been known for DOTIMES to expand in such a way to  
>> make
>>  the counter (at least internally) reach the limit.
>
> In that I would prefer another name -- since ARRAY-INDEX is not a  
> descriptive
> one anymore. ARRAY-DIMENSION would be more correct then.

Sounds good to me.

>>  In any case that was my unstated rationale for the definition.  If
>>  people are more confortable using ARRAY-DIMENSION-LIMIT.  In this
>>  case, I think the definition should look like
>>
>>         (deftype array-index ()
>>             `(integer 0 (,array-dimension-limit)))
>>
>>  as A-D-L is already the upper exclusive limit.
>
> ...for dimension, not index. :)

Ok as well.

Cheers

--
Marco Antoniotti





More information about the cdr-discuss mailing list