pub struct OpenClause {
pub namespace: Name,
pub only: Option<Vec<Name>>,
pub hiding: Vec<Name>,
pub renaming: Vec<(Name, Name)>,
}Expand description
One open clause: a namespace, and WHICH of its names it brings in, under WHICH spelling.
Lean’s four forms (Lean/Elab/Open.lean:63-96), and they are not sugar for one another:
Open Alpha. brings in all of them; Open Alpha (a b). brings in exactly those two;
Open Alpha hiding (a). brings in the rest; Open Alpha renaming a -> b. brings in a under
the local spelling b and brings in nothing else. Opening a namespace WHOLESALE is what makes
short names ambiguous in the first place, so the three narrowing forms are the tools for
AVOIDING an ambiguity rather than being told about one — and renaming is the only one of
them that can bring in a name whose short spelling already means something else here.
Fields§
§namespace: NameThe namespace. As written when the clause is parsed; resolved against the current namespace when it is applied.
only: Option<Vec<Name>>Open Alpha (a b). — ONLY these names are brought in. None is the wholesale opening.
hiding: Vec<Name>Open Alpha hiding (a b). — every name EXCEPT these.
renaming: Vec<(Name, Name)>Open Alpha renaming a -> b. — (the member, the local spelling). A clause with any
renaming brings in EXACTLY these, which is why it is its own form and not a modifier on the
others: Lean’s renaming arm emits only OpenDecl.explicit entries and no simple open
(Lean/Elab/Open.lean:89-96), so open Baz renaming orig → ali leaves untouched
unknown.
Implementations§
Trait Implementations§
Source§impl Clone for OpenClause
impl Clone for OpenClause
Source§fn clone(&self) -> OpenClause
fn clone(&self) -> OpenClause
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more