We have already explained our default convention when a submodule
is imported indirectly and transitively into
through the direct importation by
of a module
that itself imports
. Then, whatever was the
mode (protecting, extending, or including) in which
was imported by
is also, by default, the mode in which
is
imported by
, unless
contains an explicit declaration importing
in a different mode. We now explain what our default convention is in
the case of diamond importations.
We talk of a diamond importation of
by
, when
is imported indirectly by
through the direct importation of two or more
different modules, say
. The problem now is that
can be imported by each of the modules
in
different modes. For example,
could import it in protecting
mode,
in extending mode,
in including mode,
and so on. What should now be the default convention for the mode in which
imports
? We adopt a convention that is consistent with a
logical understanding of such importation declarations. Indeed,
such declarations impose semantic constraints of decreasing strength;
that is, we have:
Note that this ``strongest wins'' default mode may not always be the
correct or intended mode in which
should import
.
Sometimes it may not be, and then the user should
overrule the default convention by declaring explicitly a
different mode in which
imports
. A pragmatic reason why
this need for overruling the default mode may arise is that,
although a weaker mode of importation (say extending) does not
logically preclude such an importation also satisfying a stronger one
(say protecting), in practice, when we declare an importation in a
weaker mode it can often be because we know or suspect that it fails to
satisfy a stronger mode. For example, when we say ``extending'' we
may often mean ``extending and not protecting.''