Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| language:namespaces [2024/07/27 16:49] – [Opening namespaces] rajit | language:namespaces [2024/07/27 16:52] (current) – [Renaming namespaces] rajit | ||
|---|---|---|---|
| Line 139: | Line 139: | ||
| ===== Opening namespaces ===== | ===== Opening namespaces ===== | ||
| - | + | If | |
| - | A second issue is one that is more about convenience. Consider | + | to have each component/ |
| - | project | + | |
| own namespace to avoid naming conflicts. This situation can result in | own namespace to avoid naming conflicts. This situation can result in | ||
| very long type names. Plus it would be more bookkeeping to have to | very long type names. Plus it would be more bookkeeping to have to | ||
| create a test environment for the types within, say, | create a test environment for the types within, say, | ||
| '' | '' | ||
| - | because not all types might be exported! | + | because not all types might be exported! |
| + | |||
| + | As a syntactic convenience, | ||
| <code act> | <code act> | ||
| Line 179: | Line 180: | ||
| In this example, the '' | In this example, the '' | ||
| has occured, there cannot be any naming conflicts. This version of '' | has occured, there cannot be any naming conflicts. This version of '' | ||
| + | |||
| + | Another renaming scenario that can be useful is to move a namespace into another one. | ||
| + | <code act> | ||
| + | import lib; | ||
| + | import lib => priv; | ||
| + | </ | ||
| + | The first import statement above loads in the '' | ||