Re: It Hurts When I Do This



GaryScott wrote:
On Apr 18, 1:32 pm, Clive Page <j...@xxxxxxxxxxxx> wrote:
In message
<9bfddca3-b45a-4649-ab77-1f894baec...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
GaryScott <garylsc...@xxxxxxxxxxxxx> writes

It doesn't logically follow that to ask for a syntax for arrayness
requires a syntax for any other attributes. The article makes it
quite clear that it is a common thought process among programmers and
a common pitfall.
I for one don't agree. It may be a common pitfall among programmers
used to inferior languages such as C, C++, and Java which really don't
support much beyond simple scalar operations, but surely Fortran
programmers are used to being able to use the name of an array and have
it mean the entire array. This has been standard practice in many
statements (READ, WRITE, PRINT, CALL, DATA, SUBROUTINE, FUNCTION, etc)
since Fortran-II (I think), certainly since Fortran-IV/Fortran 66.

The main change since then is that the whole-array notation was extended
to every other appropriate context, and especially to expressions and
assignments. Of course this change came in as recently as 1990.

I really don't think that a new notation is required just because some
programmers are a bit slow to catch on to the new thought processes
required. Of course it doesn't help that so many other languages are
still stuck in the scalar era. Perhaps it's these that need a change of
syntax?
If they supported whole-array operations, as a modern language surely
should, the problem wouldn't arise. :-)

--
Clive Page

Other languages with whole array syntax support it properly by
including a syntax for consistently differentiating arrayness versus
scalarness. In this single instance, Fortran has it wrong. It leads
to ambiguous (actually hidden) meaning when humans are reading the
code because it looks exactly like a scalar operation, a very
different thing.

Two problems, The article talks about adding (:) as a way to indicate
arrayness. Some arrays are multi-dimensional; F2008 allows the
sum of rank and corank to be up to 15. It's hard to say that
A(:,:,:,:,:,;,;,;)[:,:,:,;,:,:,:] adds clarity. There would need
to be a different symbol.

Second, many people (well, me sometimes) think of a structure
as an inhomogeneous "array". When humans read code involving
whole structures it's just as confusing (to me). And, there
is no way to indicate that something is a whole structure.


Anyway, I wasn't intending to start an argument, but merely to point
those interested in reading the latest edition of "Dr. Fortran".

Oh come on, one of the main purposes of c.l.f is to allow people
to argue in a civil manner. ;) ;) That's how we reach collective
wisdom.

*** Hendrickson
.