Skip to content

Commit

Permalink
Cleanup related to 'import'
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 13, 2020
1 parent f9a076b commit e8b45c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ \section{Record Constructor Functions}\label{record-constructor-functions}
fully qualified names.

\begin{nonnormative}
The partial flattening is performed in order to remove potentially conflicting import statements in the record constructor function due to flattening the inheritance tree.
The partial flattening is performed in order to remove potentially conflicting import-clauses in the record constructor function due to flattening the inheritance tree.
\end{nonnormative}

All record elements (i.e., components and local class
Expand Down
2 changes: 1 addition & 1 deletion chapters/inheritance.tex
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ \subsection{Restrictions on the Kind of Base Class}\label{restrictions-on-the-ki
own kind and from \lstinline!class!.

\begin{nonnormative}
E.g.\ a package can only be base class for packages. All other kinds of classes can use the import statement to use the contents of a package.
E.g.\ a package can only be base class for packages. All other kinds of classes can use the import-clause to use the contents of a package.
\end{nonnormative}

\begin{example}
Expand Down
11 changes: 4 additions & 7 deletions chapters/packages.tex
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,15 @@ \section{Importing Definitions from a Package}\label{importing-definitions-from-
\lstinline!import $\mathit{shortname}$ = $\mathit{packagename}$.!% Break up \lstinline as workaround for LaTeXML issue described above.
\lstinline!$\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 $\mathit{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.

\subsection{Lookup of Imported Names}\label{lookup-of-imported-names}

This section only defines how the imported name is looked up in the import clause. For lookup in general -- including how import clauses are used -- see \cref{static-name-lookup}.
This section only defines how the imported name is looked up in the import-clause. For lookup in general -- including how import-clauses are used -- see \cref{static-name-lookup}.

Lookup of the name of an imported package or class deviates from the normal lexical lookup. For example, consider \lstinline!A.B.C! in the clauses \lstinline!import A.B.C;!, \lstinline!import D = A.B.C;!, or \lstinline!import A.B.C.*;!.
Here, lookup starts with the lexical lookup of the first part of the name (\lstinline!A!) at the top-level.
Lookup of the name of an imported package or class deviates from the normal lexical lookup. For example, consider \lstinline!A.B.C! in the clauses \lstinline!import A.B.C;!, \lstinline!import D = A.B.C;!, or \lstinline!import A.B.C.*;!. Here, lookup starts with the lexical lookup of the first part of the name (\lstinline!A!) at the top-level.

Qualified import clauses may only refer to packages or elements of packages, i.e., in \lstinline!import A.B.C;! or \lstinline!import D = A.B.C;!, \lstinline!A.B! must be a package. Unqualified import clauses may only import
from packages, i.e., in \lstinline!import A.B.*;!, \lstinline!A.B! must be a package.
Qualified import-clauses may only refer to packages or elements of packages, i.e., in \lstinline!import A.B.C;! or \lstinline!import D = A.B.C;!, \lstinline!A.B! must be a package. Unqualified import-clauses may only import from packages, i.e., in \lstinline!import A.B.*;!, \lstinline!A.B! must be a package.

\begin{nonnormative}
In \lstinline!import A;! the class \lstinline!A! can be any class which is an element of the unnamed top-level package.
Expand Down
3 changes: 1 addition & 2 deletions chapters/revisions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,7 @@ \subsection{Contributors to Modelica 3.3}\label{contributors-to-modelica-3-3}
The spatialDistribution operator was initiated by Hubertus Tummescheit,
based on an operator of Dymola, and with contributions from Hans Olsson.

The improved definition of pure and impure functions and the enhanced
import statement was proposed by Peter Fritzson.
The improved definition of pure and impure functions and the enhanced import-clause was proposed by Peter Fritzson.

The various smaller language improvements based on submitted tickets
have been developed by a group headed by Hans Olsson and with group
Expand Down
19 changes: 5 additions & 14 deletions chapters/scoping.tex
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,12 @@ \subsection{Simple Name Lookup}\label{simple-name-lookup}
\lstinline!component-declaration!) of the class (including elements inherited from
base-classes).
\item
Among the import names of qualified import statements in the
\emph{instance} scope. The import name of \lstinline!import A.B.C!; is \lstinline!C! and the
import name of \lstinline!import D=A.B.C;! is \lstinline!D!.
Among the import names of qualified import-clauses in the \emph{instance} scope. The import name of \lstinline!import A.B.C!; is \lstinline!C! and the import name of \lstinline!import D=A.B.C;! is \lstinline!D!.
\item
Among the public members of packages imported via unqualified
import-statements in the \emph{instance} scope. It is an error if
this step produces matches from several unqualified imports.
Among the public members of packages imported via unqualified import-clauses in the \emph{instance} scope. It is an error if this step produces matches from several unqualified imports.
\end{itemize}

Import statements defined in inherited classes are ignored for the lookup, i.e.\ import statements are not inherited.
Import statements defined in inherited classes are ignored for the lookup, i.e.\ import-clauses are not inherited.

\subsection{Composite Name Lookup}\label{composite-name-lookup}

Expand Down Expand Up @@ -156,10 +152,7 @@ \subsection{Global Name Lookup}\label{global-name-lookup}
For a name starting with dot, e.g.: \lstinline!.A! (or \lstinline!.A.B!, \lstinline!.A.B.C! etc.) lookup is performed as follows:
\begin{itemize}
\item
The first identifier (\lstinline!A!) is looked up in the global scope. This is
possible even if the class is encapsulated and import statements are
not used for this. If there does not exist a class \lstinline!A! in global scope
this is an error.
The first identifier (\lstinline!A!) is looked up in the global scope. This is possible even if the class is encapsulated and import-clauses are not used for this. If there does not exist a class \lstinline!A! in global scope this is an error.
\item
If the name is simple then the class \lstinline!A! is the result of lookup.
\item
Expand Down Expand Up @@ -478,9 +471,7 @@ \subsubsection{The Instance Tree}\label{the-instance-tree}
instance scope is the starting point for name lookup.

\begin{nonnormative}
If the name is not found the lookup is continued in the instance scope corresponding to the lexically enclosing class. Extends clauses are treated as unnamed nodes in the
instance tree -- when searching for an element in an instance scope the search also recursively examines the elements of the extends clauses. Except that inherited
import-statements are ignored.
If the name is not found the lookup is continued in the instance scope corresponding to the lexically enclosing class. Extends clauses are treated as unnamed nodes in the instance tree -- when searching for an element in an instance scope the search also recursively examines the elements of the extends clauses. Except that inherited import-clauses are ignored.
\end{nonnormative}

\subsubsection{The Instantiation Procedure.}\label{the-instantiation-procedure}
Expand Down

0 comments on commit e8b45c0

Please sign in to comment.