From 6dd5088519453bcad5f367b3c6dd3cfeb0e9cd5c Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 3 Mar 2021 22:17:06 -0500 Subject: Documentation on namespaces --- docs/doc/syntax.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/doc/syntax.html') diff --git a/docs/doc/syntax.html b/docs/doc/syntax.html index b77b5660..a2eb77b3 100644 --- a/docs/doc/syntax.html +++ b/docs/doc/syntax.html @@ -150,6 +150,7 @@ ¯3

Exports

+

See namespaces: this section is a little out of date.

The double arrow is used to export variables from an immediate block or file. It can only be used in these contexts, and not in function or modifier blocks. There are two ways to export variables. First, in the variable definition can be replaced with to export the variable as it's defined. Second, an export statement consisting of an assignment target followed by with nothing to the right exports the variables in the assignment target and does nothing else. Export statements can be placed anywhere in the relevant program or body, including before declaration or on the last line, and a given variable can be exported any number of times.

aliasa, b, c0c1c, b2b{
   bc   # Non-definition exports can go anywhere
@@ -158,7 +159,7 @@
   cb"str"
 }
 
-

A block with exports is a namespace block, and in versions of BQN without first-class namespaces it can only be used as part of a destructuring assignment. This assignment's target is a list where each element specifies one of the names exported by the block and what it should be assigned to. The element can be either a single name (such as b above), which gives both, or a combination of a name, then :, then the assignment target. If : is never used, the names can be given as a strand with . To use : for aliases, bracket syntax ⟨⟩ is needed. Imported names can be repeated and can be spelled with any role (the role is ignored).

+

A block with exports is a namespace block, and in versions of BQN without first-class namespaces it can only be used as part of a destructuring assignment. This assignment's target is a list where each element specifies one of the names exported by the block and what it should be assigned to. The element can be either a single name (such as b above), which gives both, or a combination of the assignment target, then , then a name. If is never used, the names can be given as a strand with . To use for aliases, bracket syntax ⟨⟩ is needed. Imported names can be repeated and can be spelled with any role (the role is ignored).

Lists and blocks

Separators

The characters and , and newline are completely interchangeable and are used to separate expressions. An expression might be an element in a list or a line in a function. Empty sections—those that consist only of whitespace—are ignored. This means that any number of separators can be used between expressions, and that leading and trailing separators are also allowed. The expressions are evaluated in text order: left to right and top to bottom.

-- cgit v1.2.3