Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok
From: ok@quintus.uucp (Richard A. O'Keefe)
Newsgroups: comp.lang.fortran
Subject: Re: Fortran versus C for numerical anal
Message-ID: <458@quintus.UUCP>
Date: 21 Sep 88 08:36:45 GMT
References: <447@quintus.UUCP> <3826@lanl.gov>
Sender: news@quintus.UUCP
Reply-To: ok@quintus.UUCP (Richard A. O'Keefe)
Organization: Quintus Computer Systems, Inc.
Lines: 49

In article <3826@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
>From article <447@quintus.UUCP>, by ok@quintus.uucp (Richard A. O'Keefe):
>> In article <3746@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
>>>No, I still like the Fortran 8x stuff better:
>>>      ALLOCATABLE, CHARACTER::TWODARRAY(:,:)
>>>      ...
>>>      ALLOCATE (TWODARRAY(10,10))
>>>      ...
>>>      TWODARRAY(5,9) = 'c'
>> ...
>> the allocate statement is _only_ applicable to pointers, not to ordinary
>> arrays.  The name TWODARRAY is used in *some* contexts to refer to the
>> pointer variable (allocate and free) and in *other* contexts to refer to
>> the thing pointed to.  "separate and distinct"?
>
>This is the proposed syntax in Fortran 8x. Fortran 8x _HAD_NO_POINTERS_!!
>So, rather obviously, the allocate statement is _NOT_ applicable to
>pointers at all.  Further, TWODARRAY is an identifier.

When I said "this is _Fortran_?" it was an exclamation of disgust at the
syntax.  I knew perfectly well that it was 8X, but 8X declarations are so
awful that they make PL/I look good.

Fortran 8X had pointers all right, it just didn't let you NAME them
unambiguously.  ``TWODARRAY'' is an identifier all right, but at compile
time it is associated with a pointer variable by the declaration, and at
run time that pointer variable is associated with an array by the allocate
statement.  To claim that TWODARRAY stands for an array simpliciter is to
accept the confusion between a pointer and an array.  Throughout the life-time
of an instance of TWODARRAY, several quite distinct arrays with distinguishable
properties (such as dimensions) may become associated with it, and at times
there may be no array at all.

Now the PL/I designers weren't stupid enough to REQUIRE this confusion, but
they were "generous" enough to ALLOW it.  In PL/I you can say
	DECLARE (TD_ONE, TD_TWO) FIXED;
	DECLARE TWODARRAY(1:TD_ONE,1:TD_TWO) CHARACTER CONTROLLED;

	TD_ONE, TD_TWO = 10;		/* define size of array */
	ALLOCATE(TWODARRAY);		/* allocate it */
	TWODARRAY(5,9) = 'c';		/* use it */
	FREE(TWODARRAY);		/* deallocate it*/
I should have thought that experience with PL/I would have convinced people
that concealing the pointer is a Bad Idea.

I'm reminded of one of Lincoln's jokes:
	Question: If you call a tail a leg, how many legs has a dog got?
	Answer:   Five.
	Riposte:  Wrong, _calling_ a tail a leg doesn't _make_ it one!