| 1 |
example.b |
| 2 |
{nā7}.n |
| 3 |
|
| 4 |
---------------------------------------------------- |
| 5 |
|
| 6 |
[ |
| 7 |
["dot-notation-on-name", "example."], |
| 8 |
["word-name", "b"], |
| 9 |
|
| 10 |
["dot-notation-on-brackets", "{"], |
| 11 |
["word-name", "n"], |
| 12 |
["punctuation", "ā"], |
| 13 |
["word-number", "7"], |
| 14 |
["dot-notation-on-brackets", "}."], |
| 15 |
["word-name", "n"] |
| 16 |
] |
| 17 |
|
| 18 |
---------------------------------------------------- |
| 19 |
|
| 20 |
A namespace is a type of value that groups together several variables |
| 21 |
(fields) from the same scope. A block or file returns a namespace if it |
| 22 |
contains any export arrows ā at the top level, and fields from namespaces can |
| 23 |
be accessed with either dot syntax or destructuring assignment. A namespace |
| 24 |
can be mutable only if any of its source code uses ā© to change the value of a |
| 25 |
field. |
| 26 |
|
| 27 |
There are also two ways to get values out of a namespace, such as example |
| 28 |
defined above. First, one field at a time can be retrieved with dot syntax: |
| 29 |
write the namespace, then a dot ., then another name. |
| 30 |
|
| 31 |
The second, destructuring assignments, does not require special highlighting. |