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

Issue: ADJUST-ARRAY-NOT-ADJUSTABLE (Version 9)



After yet more careful study I conclude that the version 9 proposal
is not a clarification but a change.  Here is the reasoning.

There is only one way in Common Lisp to adjust an array, and that is by
calling ADJUST-ARRAY.  (The definition of VECTOR-PUSH-EXTEND, p. 296,
specifically says that it uses ADJUST-ARRAY, and other places in the
language, such as FORMAT with a string as first argument, refer to
VECTOR-PUSH-EXTEND.)

Hence it is senseless to speak of an array that is "adjustable" but cannot
under any circumstances legitimately be given to ADJUST-ARRAY.

Now look at the definition of ADJUST-ARRAY, pp. 297-98.

  It is not permitted to call ADJUST-ARRAY on an array that was not
  created with the :ADJUSTABLE option.  The predicate ADJUSTABLE-ARRAY-P
  may be used to determine whether or not an array is adjustable.

I reason that the first sentence prohibits any array not created with
the :ADJUSTABLE option from being given to ADJUST-ARRAY under any
circumstances.  This includes having been tested with ADJUSTABLE-ARRAY-P.
Therefore any array not created with the :ADJUSTABLE option must be
not adjustable.  Therefore ADJUSTABLE-ARRAY-P must return NIL when
given such an array.  Therefore the following items of the proposal
cannot be true of the current (CLtL) specification:

  1.                                    ... Whether ADJUSTABLE-ARRAY-P is
  true of some other arrays is unspecified.

  b. There is no specified way to create an array for which ADJUSTABLE-ARRAY-P
     definitely returns NIL.

Therefore the proposal is a change and not a clarification, and
should be labeled as such.

----------------------------------------------------------------
I think that the following points also require clarification or comment:

(1) What is a compiler permitted to conclude from the declarations
	(DECLARE (SIMPLE-ARRAY FOO)
	         (TYPE (AND ARRAY (NOT SIMPLE-ARRAY)) BAR))
    ?

(2) What is a program permitted to conclude from the test
	(TYPEP X 'SIMPLE-ARRAY)
    both when it returns true and when it returns false?

(3) I believe that much of the controversy stems from disagreement over
    whether the definition on page 28 is considered to be an implication
    or an equivalence.  That is, I think everyone agrees that the
    sentence could be rephrased as:

	An array is simple __________ it is is not displaced to another
	array, has no fill pointer, and is not adjustable.

    but they disagree on whether the blank should read "if" or "iff".
    The proposal should state explicitly which of these two interpretations
    (or what third interpretation) is assumed.

--Guy