Subject: [YANG] combining sub-modules

From: Andy Bierman <[email-masked]>
Date: Fri, 04 Jan 2008 16:29:53 -0800

Hi,

What are the rules for duplicate definitions in different submodules?
Assume main module 'foo' and 3 submodules.
What if sub-module A includes C, and B also include C?

    module foo
        |
        |
    +---+---+
    |       |
    A       B
    |       |
    C       C

If C has top-level definitions, or if submodules A and B simply
define the same top-level nodes, then there will be duplicates
(in the C case, may be different in the other case).

Is the 2nd 'include C' allowed?  I think so.  No rules broken, no loops.
Sec. 5.1 is not very clear on combining submodules to form
a single conceptual module.

For example, the intent is that submodules must be self-compiling,
and all definitions must be local, imported, or included in the submodule.
Submodule C cannot include A or B, and must not reference any definitions
from A or B.  None of the submodules can reference any definitions from
the main module foo.  This is not very clear.

So the compiler needs to ignore any 'duplicate object' errors
that occur from the A-C, B-C scenario, but if A and B use
the same top-level object name, it is a fatal error?
Top-level definitions can be imported from foo, regardless
of module or submodule location.

Andy

_______________________________________________
YANG mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/yang

---

From: Phil Shafer <[email-masked]>
Date: Mon, 07 Jan 2008 12:45:29 -0500

>of module or submodule location.

The decision is up to the compiler, but my take is that the compiler
should parse modules and submodules individually, keeping the data
organized into modules and submodules.  When it sees an import or
include for something it's already parsed, it can reference the
parsed data, not redo the work.  So "ignore" in a sense, but not
in the #once sense.

If A and B both define the same top-level object name, it's an
error, since they are in the same namespace.  B can augment A's
objects (and vice versa), but not redefine them.

Thanks,
 Phil