[J3] Private enumerators

Bill Long longb at cray.com
Sat Oct 19 13:53:24 EDT 2019

> On Oct 19, 2019, at 10:37 AM, Van Snyder via J3 <j3 at mailman.j3-fortran.org> wrote:
> Gary objected to private enumerators.
> Access specs control access to identifiers, not objects.
> He didn't like the possibility that one might be able to get the value
> of an enumerator for which the module did not publish the name, using,
> for example, INT(foo)+1 or foo%next().

This argument might make sense if it were prohibited to have variables of the enum type.  If you can have a variable, var, then set it equal to the enum the proceeds (private) foo, and then 

var = var%next()
k = int(var)

Similar issue if it is allowed to have variables of the enum type with the pointer attribute, and you pointer associate that pvar with one of the enums. The next() your way to foo.  Also, within the module where the enum is declared, you could have a pointer associated with foo that would provide access outside the module. 

Prohibiting variables (with or without allowing the POINTER attribute),  seems like a pretty serious limitation.

> I'm not quite sure how having a public enumerator makes that better.  In
> fact, having a public enumerator seems to make it worse.
> Can we have a mail vote to proceed with 19-249r1?

This does not seem like a good time to start down this route.



Bill Long                                                                       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

More information about the J3 mailing list