Hello,
My one cent:
> Personally I would prefer saving [] for something significant, not
> just a small shortcut for one subset of an implied do.
>
> This battle has already been lost. Fortran 2003 has [] for array
> constructors.
First, I think array constructors are significant to warrant special
treatment. This is not to say I necessarily agree with the F03 choice,
but, I can see merit in it.
Over time I have become a fan of reusing syntax for different things,
when ambiguity is not present of course. This rather than saving tokens
for future generations. My favorite example is using parens for both
array-element access, and for function references. At first I did not
like it because I thought the C array[i] made it easier to read the
code, and my preprocessor (FWEB) pretty-printed those as subscripts.
But, then I realized that the ability to replace an array with a
function and vice versa and not affect the code is much more important.
Example:
my_datastructure%database(i)=5
No-one cares whether database is a direct array or something more
complex. The code is super clear. This does not work for array-sections
however! If one could switch between an array section and an array
constructor with the same syntax however, it would be nice. Example:
my_datastructure%database([1:n])
If database is a function, this provides an array constructor as an
actual argument, otherwise it is an array section (and not a
vector-subscript one, but a regular one). Of course one has to put some
more thought into whether this really works, but you get my point.
Syntax reuse is good, IMO.
Best,
Aleks
|