[J3] Thoughts on the semantics of generics
Van Snyder
van.snyder at jpl.nasa.gov
Mon Aug 13 04:46:46 EDT 2018
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).
More information about the J3
mailing list