Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a name resolution example #1

Open
david-waltermire opened this issue May 25, 2024 · 0 comments
Open

Provide a name resolution example #1

david-waltermire opened this issue May 25, 2024 · 0 comments

Comments

@david-waltermire
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant