(j3.2006) contiguous sections

Malcolm Cohen malcolm
Mon Jul 7 20:58:55 EDT 2008

```At 06:26 08/07/08, Bill Long wrote:
>Consider this example:
>
>Integer a(10)
>
>Print *, is_contiguous(a(10:1:-1))
>End
>
>
>Does this print T or F?

F.

>   In 5.3.7, 6(c) we say "the elements of the
>section in array element order [here a(10), a(9), ..., a(1)], are a
>subset of the base object elements that are consecutive in array element
>order [here a(1), a(2), ..., a(10)]."

Looks like a contradiction to me, you just said that
[ a(10), a(9) ... a(1) ]
is the same as
[ a(1),  ... a(9), a(10) ].

Since your "here" number 1 isn't the same as your "here" number 2 you
have falsified your own argument, surely?

>   As a collection of elements,
>these two sets are the same,

Sets don't have order, so we cannot mean that (and we don't).

>  so the condition of "subset" seems to be satisfied.

It does not satisfy the whole condition (6)(c), whether you can take
the words of (6)(c) and say it partially satisfies a subset of those
words isn't relevant.

>   But did we intend that the ordering of the two sets also has
>to to the the same?

Again, sets as sets don't have order.  We are talking explicitly
about array element order, which is a well-defined concept.  Since we
are talking about order, we must therefore be talking about order.

>   I think so, considering that we disallowed vector
>subscripts.  But it is not clear that the current wording clearly
>supports that claim.

Surely it is clear that we would not even mention "in array element
order" if we did not mean it and it did not affect the result.
Therefore we do mean it and it does affect the result.

>   Another way to ask the question is whether the
>goal is "adjacent in memory", or "stride-1 access".

Not a very good way, since "stride-1 access" isn't well-defined.

My way of asking the question is why did we say "in array element
order" if we didn't mean it?  There can be no question about this.

Let's try to read it again.  It says
"the elements of the section, *IN ARRAY ELEMENT ORDER*, are a
subset of the base object elements that are consecutive *IN ARRAY
ELEMENT ORDER*".

Your "bad reading" is ignoring the first "in array element order"
which explicitly relates the order of the elements in the section to
the order of the elements in the base.  If you are not considering
the ordering to be the same, then this first phrase has no meaning
(you get the same result with or without it).  Obviously that cannot be right.

I honestly cannot see how this can be misread without deliberately
ignoring some part of the sentence.

It could be reworded to split the subsetting from the ordering, but
that would make the already-long-and-complicated-condition even
longer and even more complicated.  This is already the 3rd
subcondition of 6 of the 6th condition that defines contiguity - do
we really want it to be the 3rd and 4th subconditions of the 6th
condition?  And it would still not be proof against readings that
ignore vital clauses!  Anyway, here is the obvious split:

From
"(c) the elements of the section, in array element order, are a
subset of the base object elements that are consecutive in array element order"
To
"(c) the elements of the section are a subset of the base object
elements that are consecutive in array element order,
(c2) the elements of the section in array element order are the
elements of the base object subset in array element order,"

I'm sure that can be wordsmithed down to something more readable; in
fact I'd wordsmith that down to exactly what we have now.  (There are
multiple ways of saying c2 separately, but none of the ones that
occurred to me were noticeably better than this one.)

I'm certainly happy to change the wording if you have anything
better, but I don't agree that your suggested "bad reading" is a
plausible one for the current wording.

It occurs to me that your "bad reading" is also falsified by the "not
contiguous" definition which states it is not contiguous if
"the elements of the object in array element order are not
consecutive in the elements of the base object".

Cheers,

--
....................Malcolm Cohen (malcolm at nag-j.co.jp)

```