Skip to content

Commit

Permalink
Re-write the list of possible import clause forms as suggested by Hans
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Jun 18, 2020
1 parent df1a917 commit 4e3fdda
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions chapters/packages.tex
Expand Up @@ -68,23 +68,20 @@ \subsection{Importing Definitions from a Package}\doublelabel{importing-definiti
% Instead, we need to break up the \lstinline at each piece of math (taking the opportunity to leave the whitespace
% outside both \lstinline and math).

\lstinline!import! $\mathit{packagename}$\lstinline!;! (qualified import)
\lstinline[mathescape=true]!import $\mathit{definitionname}$;! (qualified import of top-level definition)

\lstinline!import! ${[}\mathit{packagename}\text{\lstinline!.!}{]}\mathit{definitionname}$\lstinline!;! (single definition import)
\lstinline[mathescape=true]!import $\mathit{packagename}$.$\mathit{definitionname}$;! (qualified import)

\lstinline!import! ${[}\mathit{packagename}\text{\lstinline!.!}{]}$\lstinline!{!$\mathit{def}_{1}$\lstinline!,! $\mathit{def}_{2}$\lstinline!,! $\ldots$\lstinline!,! $\mathit{def}_{n}$\lstinline!};! (multiple definition import)
\lstinline[mathescape=true]!import $\mathit{packagename}$.{$\mathit{def}_{1}$, $\mathit{def}_{2}$, $\ldots$, $\mathit{def}_{n}$};! (multiple definition import)

\lstinline!import! $\mathit{packagename}$\lstinline!.*;! (unqualified import)
\lstinline[mathescape=true]!import $\mathit{packagename}$.*;! (unqualified import)

\lstinline!import! $\mathit{shortpackagename}$ \lstinline!=! $\mathit{packagename}$\lstinline!;! (renaming import)
\lstinline[mathescape=true]!import $\mathit{shortname}$ = $\mathit{definitionname}$;! (renaming import of top-level definition)

\lstinline!import! $\mathit{shortpackagename}$ \lstinline!=! ${[}\mathit{packagename}\text{\lstinline!.!}{]}\mathit{definitionname}$\lstinline!;! (renaming single def.\ import)
\lstinline[mathescape=true]!import $\mathit{shortname}$ = $\mathit{packagename}$.$\mathit{definitionname}$;! (renaming import)

Here $\mathit{packagename}$ is the fully qualified name of the imported
package including possible dot notation and $\mathit{definitionname}$ is the
name of an element in a package. The multiple definition import is
equivalent to multiple single definition imports with corresponding
packagename and definition names.
Here $\mathit{packagename}$ is the fully qualified name of the imported package including possible dot notation and $\mathit{definitionname}$ is the name of an element in a package. The multiple definition import is equivalent
to multiple single definition imports with corresponding $\mathit{packagename}$ and definition names.

\subsubsection{Lookup of Imported Names}\doublelabel{lookup-of-imported-names}

Expand All @@ -106,13 +103,9 @@ \subsubsection{Lookup of Imported Names}\doublelabel{lookup-of-imported-names}
\end{nonnormative}

\begin{nonnormative}
For example, if the package \lstinline!ComplexNumbers! would have
been declared as a subpackage inside the package \lstinline!Modelica.Math!,
its fully qualified name would be \lstinline!Modelica.Math.ComplexNumbers!.
Definitionname is the simple name without dot notation of a single
definition that is imported. A shortpackagename is a simple name without
dot notation that can be used to refer to the package after import
instead of the presumably much longer packagename.
For example, if the package \lstinline!ComplexNumbers! would have been declared as a subpackage inside the package \lstinline!Modelica.Math!, its fully qualified name would be
\lstinline!Modelica.Math.ComplexNumbers!. $\mathit{definitionname}$ is the simple name without dot notation of a single definition that is imported. A $\mathit{shortname}$ is
a simple name without dot notation that can be used to refer to the package after import instead of the presumably much longer $\mathit{packagename}$.

The forms of \lstinline!import! are exemplified below assuming that we want to
access the addition operation of the hypothetical package \lstinline!Modelica.Math.ComplexNumbers!:
Expand Down

0 comments on commit 4e3fdda

Please sign in to comment.