[J3] [EXTERNAL] Re: Re: Slides available for your preview - Part 2 of the Generics Tutorial today at the J3 plenary

William Clodius w.clodius at icloud.com
Wed Mar 10 01:05:33 UTC 2021


Templates and generics are synonyms. there is not difference in their implications or use. The reasons the example is complicated include:

	1. Container templates are more complicated than algorithmic templates.
	2. I wanted an example of a module template with components that want to be generics with parameters in addition to the module’s standard parameters, an even more complicated example. This was intended to address Tom’s/Magne’s concern that such contained generics necessarily increased the number of module template parameters.
	3. Fortran's syntax is complicated.
		A. Type declaration syntax for arguments is wordy and cannot be included in a module's/procedure’s declaration syntax, and I kept that property for the template’s parameters.
		B. Procedure declaration syntax is particularly wordy.
		C. Structures’ have to be terminated by an end structure-name statement.
		D. Fortran’s lexing is case insensitive which often results in wordy naming conventions to distinguish modules, from the enclosed type declarations, and objects of that type.
	4. Fortran doesn’t have an iteration construct. With such a construct the MAP procedure could have been moved out of the templated module and made a standalone templated procedure or module. In the event I could still have made it a stand alone generic procedure or module, but limited in its generosity to types with an ADD_ELEMENT  and a  T_TO_S procedures of the proper syntax and semantics.
	5. The generics subgroup wants to add something equivalent to a REQUIREMENTS section describing formal requirements on the template’s parameters. C++ has something similar called concepts, that were originally just documented in comments, but now may be (optionally) expressed directly in source code, so it is something that is rarely seen in the wild at this moment.

> On Mar 9, 2021, at 3:24 PM, Bill Long via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> Does seem unnecessarily complicated.  We have to keep in mind that designing something that people want to use is a high priority.  And keep in mind that the newbies we will want to use this stuff will have learned C++ in school.  Simple procedure templates that are compiled (and likely inlined) at instantiation time. 
> 
> I’ve never heard Fortran criticized for lacking “generics”, but have often heard that the critical thing (in the minds of C++ programmers) missing in Fortran is templates. 
> 
> Cheers,
> Bill
> 
>> <snip>
> 
> Bill Long                                                                       longb at hpe.com
> Engineer/Master , Fortran Technical Support &   voice:  651-605-9024
> Bioinformatics Software Development                      fax:  651-605-9143
> Hewlett Packard Enterprise/ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210309/9d7539fd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1619 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210309/9d7539fd/attachment.bin>


More information about the J3 mailing list