[J3] Thoughts on the semantics of generics

William Clodius w.clodius at icloud.com
Mon Aug 13 11:22:22 EDT 2018


It might be useful to introduce the concept of a “pure" or "virtuous" module, one with no state outside of the internal stat of the derived types and that does not use a module with internal state. For a “pure” module it is never useful to treat each instantiation as unique.

> On Aug 13, 2018, at 2:46 AM, Van Snyder <van.snyder at jpl.nasa.gov> wrote:
> 
> On Sun, 2018-08-12 at 16:25 -0600, William Clodius via J3 wrote:
>> It can happen that the same generic is instantiated multiple times
>> with the same parameters. This raises two questions. If the generic
>> has internal state, do all "duplicate" instantiations share the same
>> state or are their states unique? 
> 
> For simplicity, I would say that each instantiation of a generic module
> is unique, even if one has exactly the same parameters as another one.
> Then, types (with identical parameters) defined in different
> instantiations of a generic module, are always different type
> definitions.  This comports with thee rule we have now: types with
> identical names and structures, defined in different scoping units, are
> different types (unless they're sequence types, ugh.).
> 
> If you want them to be the same, instantiate the module once, either
> within a module, or by instantiating a generic module as an independent
> free-standing module (if we invent syntax to do that).
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20180813/3e65572f/attachment.html>


More information about the J3 mailing list