Allow qualified identifiers that begin with a dot. An initial dot indicates that the qualified identifier is to be resolved from the top level, regardless of where it appears. This feature provides a way to refer to symbols that are hidden by definitions in an inner scope. It is similar to an initial :: in a C++ name qualifier.
For example:
constant a = 0
module M {
constant a = 1 # M.a hides a here
constant b = a # Sets b to 1
constant c = .a # Sets c to 0
constant d = .M.a # Same as constant d = a
}
In this scheme, there are two kinds of qualified identifiers:
- Relative qualified identifiers: Each of these is a list of simple names separated by dots. It specifies a qualified name relative to the innermost scope in which the first simple name is defined. For example, when
a is defined in scope M, then inside scope M, a refers to M.a. This is true regardless of whether a is defined at the top level.
- Absolute qualified identifiers: Each of these is a dot followed by a relative qualified identifier. It specifies a name relative to the top scope. For example, when
a is defined at the top level, then .a refers to a. This is true even in a scope M that also defines a.
Allow qualified identifiers that begin with a dot. An initial dot indicates that the qualified identifier is to be resolved from the top level, regardless of where it appears. This feature provides a way to refer to symbols that are hidden by definitions in an inner scope. It is similar to an initial
::in a C++ name qualifier.For example:
In this scheme, there are two kinds of qualified identifiers:
ais defined in scopeM, then inside scopeM,arefers toM.a. This is true regardless of whetherais defined at the top level.ais defined at the top level, then.arefers toa. This is true even in a scopeMthat also definesa.