[J3] Ada contract model for generic packages
Van Snyder
van.snyder at sbcglobal.net
Thu Mar 11 21:26:58 UTC 2021
On Thu, 2021-03-11 at 12:33 -0700, William Clodius via J3 wrote:
> Submodules only implement (parts of) the procedure parts of a module,
> which makes them awkward to use as the implementation of derived
> types. However the separation of specification and implementation
> could be handled by making the specification of the template
> parameters be a formal part of the specification part of the module.
Submodules were explicitly patterned on the separation of specification
from implementation in Modula-2 and Ada. THey can contain more than
procedures. They can contain anything a module can contain.
04-383r1 explicitly proposed that module parameters are a formal part
of the specification of the module. To provide a contract model, so
that the legality of a parameterized module could be determined before
it is instantiated, everything about its parameters needs to be
described. This is the equivalent of an interface block. Allowing
formal parameters to be parameterized modules requires nothing more
esoteric than the equivlaent of nested interface blocks.
If parameterized modules are allowed to have submodules, the submodules
would inherit the specification from their parent.
> > On Mar 11, 2021, at 12:09 PM, Van Snyder via J3 <
> > j3 at mailman.j3-fortran.org> wrote:
> >
> > <snip>
> > Ada allows a generic package to have a separate specification and
> > body. In the Fortran context, that would be a module and submodule.
> >
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210311/ea4520d6/attachment.htm>
More information about the J3
mailing list