[J3] [EXTERNAL] Private enumerators

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Fri Oct 25 16:49:06 EDT 2019


As devils advocate,  I think Van’s point is that there are degrees of risk for various “inaccessible” things within Fortran.      The out-of-bounds was just to exaggerate the point.

The private enumerators with procedures that can return references to things whose value is the private enumerator value (not the name) is really entirely analogous to a user derived type with type bound procedures  that can return pointers to private components.   (Actually, enumerators are a bit safer, as you can’t actually change the enumerator, so it’s more like a const pointer.)

At the same time I recognize that it would usually be silly to have PRIVATE enumerators while using NEXT() and PREV().      In theory each feature is driven by different requirements that generally don’t both apply to a given use case.         And we would prefer to prevent client code from abusing the intent of the creator, and that’s really what is different here than in the user derived type case.      The implementor of the enum-type may want some things to be private, but the implementor of the client code does not have to respect it.

Is anyone strongly opposed to bringing back enum extensions as a way to (at least partially) bypass this issue and move on?   The removal was only because we did not have a use case during the debate.   It appears we now have one.   Requirements and specs for extensions were already written based upon papers that passed in Tokyo, but then deleted during the subcommittee work last week.

- Tom




On Oct 25, 2019, at 4:21 PM, Bill Long via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>> wrote:


On Oct 25, 2019, at 3:11 PM, Van Snyder via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>> wrote:


If a private component appears after (or before) an array component, the
private component can be accessed by using out-of-bounds subscripts.

Umm, no.  You can access anything by using out-of-bounds array subscripts.  At least in the version of Fortran I know about.   Besides, trying might risk on-fire underpants.

Cheers,
Bill


Bill Long                                                                       longb at cray.com<mailto:longb at cray.com>
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray, a Hewlett Packard Enterprise company/ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20191025/ebc90a8c/attachment-0001.html>


More information about the J3 mailing list