[J3] Comments on 23-148

Van Snyder van.snyder at sbcglobal.net
Sat Feb 25 01:16:46 UTC 2023


23-148 proposes additional features for generics. The rationale is to
"go a long way toward enabling user-defined containers." See 23-109
(Support for Containers), which is posed as a TS proposal but could be
viewed as a 202Y feature proposal. The important concepts in that
proposal are uniform syntax to reference what might be procedures or
data objects in the container, and updaters (called setters in python).

23-109 references several papers that explain the advantages of uniform
syntax. I argued for it at the 1986 Albuquerque meeting, but the
sentiment "Fortran programmers want to see what their program is doing"
won out. Of course, that is exactly what you DO NOT want, as explained
by David Parnas in "On the criteria for dividing programs into modules"
in December 1970 CACM. He pointed out that "seeing what your program is
doing" results in the cost of a modification more likely being
proportional to the size of the program than to the extent of the
revision.

The specific controversy in 1986 was the notation to reference
structure components. The percent sign had been introduced as a "place
holder" because dot clearly had problems. The percent sign got stuck in
place. I advocated for COMPONENT(OBJECT) instead of OBJECT%COMPONENT,
because I had already used that syntax in Fortran IV processors that
treated statement functions as macros, so that references to them were
allowed in variable-definition contexts if their bodies were allowed
therein. One could easily replace a reference to the statement function
(i.e., macro) with a real function, but to use it in a variable
definition context requires an updater procedure. References to and
definitions of arrays and structures are just function/updater pairs
that the processor knows how to write, inline, and optimize. This is
all laid out in excruciating detail in 23-109.

Specific items in 23-148 included

- canonical mechanisms for looping/iterating over items in a container

See 23-107 (coroutines and iterators), for looping/iterating over
anything, not just items in a container. 23-107 is posed as a TS
proposal, but it could be viewed as a 202Y feature proposal.

-  enable other analogs of array features such as slices

See the parts of 23-109 that deal with the SECTION type. The SECTION
type is necessary for uniform syntax, to allow an array to be replaced
by a function and updater.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230224/e7df201b/attachment-0001.htm>


More information about the J3 mailing list