Nominal ReferencesΒΆ
A nominal reference is a kind of accessor that is used to refer to the value or type of a nominally identified member that has been declared in the lexical scope in which the reference is placed. Nominal references are accessors that do not start with a dot .
.
For instance, in the following snippet:
x = 'top-secret'
o = {
key = x
}
x
(the value of o.key
) is a nominal reference to the value of the member identified as x
(which turns out to be the 'top-secret'
string). To summarize, here the value of o.key
is 'top-secret'
.
Note
A reference that is not found in the lexical scope abrutply halts the execution of the interpreter with this informative message:
error: could not find <accessor> in context:
at <row>:<col>:
<accessor>
^
In a similar way, a reference that is found multiple times in the lexical scope abrutply halts the execution of the interpreter with this informative message:
error: found multiple candidates for <accessor>:
at <row>:<col>:
<accessor>
^
note: candidates are:
at <row>:<col>:
<identifier> = ''
^
at <row>:<col>:
<identifier>: Result = {
^
.
.
.