I was there, if nobody else remembers. At the time (final stages of F77
- "Hollerith in the guise of integer data type" was just being replaced
or downgraded), a lot of people (especially Jerry Wagener?) felt the
same way - "a string is just a one-dimensional array whose elements
happen to have a particular type." True, of course, as far as it goes.
I think that the reason strings are described differently is that most
OPERATIONS you want to perform on a string are a lot different from what
you do with arrays of most other types. For example, "lexicographic
ordering" for unique to strings - but "A > B" for (other) arrays is
elementwise. Similarly, a lot of intrinsics are needed (or at least,
very useful) for strings but don't make much sense for arrays of numbers
- such as INDEX().
Of course C (later?) chose to implement strings as arrays, but if you
try to program something like a "string sort" in C you immediately see
why Fortran got it right (imho).
=
Loren P Meissner
Check it out!
www.meiszen.net
-----Original Message-----
>>It was never clear to me why strings weren't just implemented as
>>character arrays. I'm sure there's a good reason; I just can't seem to
>>find it.
|