[comp.lang.fortran] Data types, pointers, etc.

cca@pur-phy (Charles C. Allen) (09/27/88)

In this discussion of pointers and data structures, I hope that people
will occasionally pause to take a somewhat broader view of things
(beyond what they think should go in FORTRAN 8x).  Yes, FORTRAN has
very little in the way of data structuring facilities, and yes,
pointers are one way to build those, and yes, pointers as implemented
in C can be dangerous.

Languages do exist that have the sort of structures people have been
talking about, without resorting to pointers and all their
difficulties.  Smalltalk, for example, has classes called
OrderedCollection (stacks and queues), SortedCollection, Set, Bag,
Dictionary (essentially keyed hash tables), and MappedCollection
(mappings of one collection to another).

I'm not suggesting Smalltalk as a substitute for FORTRAN (at least,
not yet :-), just that other people have looked at this sort of thing
before and come up with solutions that bear looking at.

Charlie Allen			cca@newton.physics.purdue.edu

ok@quintus.uucp (Richard A. O'Keefe) (09/28/88)

In article <1475@pur-phy> cca@pur-phy (Charles C. Allen) writes:
>In this discussion of pointers and data structures, I hope that people
>will occasionally pause to take a somewhat broader view of things      ...
>Languages do exist that have the sort of structures people have been
>talking about, without resorting to pointers and all their
>difficulties.  Smalltalk, for example,					...

It is worth noting that most such languages notionally make _everything_
a pointer.  (SETL is an exception.)  Smalltalk-80, for example, has that
amazing operation "become:".  The distinction between pointer-based and
value-based views come up when you consider assignment.  Simula 67, for
example, had two assignment operators:
	Lhs := Rhs;	!copy the value of Rhs onto the storage of Lhs;
	Lhs :- Rhs;	!make Lhs point to whatever Rhs points to;

If I understand the Fortran 8X ALLOCATE stuff correctly, since array
assignment copies the contents of the source to the destination, and
since no methods are provided for copying the pointer, it is providing
a value-based model rather than a pointer-based one.  But the allocation
status of the hidden pointer variable is still important.