Skip to content

Provide a name resolution example #1

@david-waltermire

Description

@david-waltermire

The following example was discussed on Element.

Given the following graph:

  • ns:complete
    • ns:profile
      • metadata
      • control-common
    • assessment-results
      • metadata
      • assessment-common

A definition with the name select-control-by-id appears in control-common and assessment-common.

The name is looked up in the scope of the model it is referenced in. When importing other modules, the last definition with the same name wins across imports in in import order, and a definition that is defined directly in the importing module wins over those.

A reference to select-control-by-id would be handled in the following ways:

  • In control-common the definition is defined in the module, so that definition will be used.
  • In profile, the definition is declared in the second module import, control-common, so that name is used.
  • in assessment-results, the name is resolved using the second module import, assessment-common.

Each imported module has a set of exported definitions. This is controlled by the definition scope. The scoped definitions for a module are determined using the Metaschema name resolution rules.

This means that the exported definitions in the complete module are determined based on the import order. Since assessment-results is imported after profile, then the select-control-by-id exported first from assessment-common, then assessment-results would be exported by complete based on the graph above. Remember, last one wins.

--

This example should be added to the name resolution section of the specification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions