Skip to content

Names and paragraphs

A name belongs to a lexical scope. Paragraphs can introduce local names and organize behavior; they are not automatically concurrent tasks.

Four spaces before a paragraph's first code line open a local scope. Following lines need not stay indented; a physical blank line outside comments or literals closes it. Preserve these boundaries when copying examples.

demo/paragraphs/local-shadowing.l
"message" is `outer`.
"message" is `inner`.
"count" is 7.
"enabled" is true.
Show message.
Show count.
Show enabled.
"message" is `second`.
Show message.
Show message.

Complete program. Source: demo/paragraphs/local-shadowing.l.

Example evidence

Sibling and enclosing source scopes preserve independent bindings. existing-witness-not-run. Evidence guide.

The initial message is outer. Each indented paragraph owns its own message; the first also owns count and enabled. The final Show refers to the outer message. Expected stdout is inner7truesecondouter, without a newline.

Unmarked declarations remain in their scope. Public/Publicly publish only the selected declaration into the enclosing program scope; inside an indexed dictionary, publication stays within that dictionary's own source unit. Public changes visibility only and preserves the declaration's identity.

Pronouns bind the last subject defined in their source paragraph, not the last printed value or completed App. In the basic program, The App refers to the App just constructed. In Building any App and then Running it, it refers to the action's App argument.

Use explicit names when several subjects appear: the multiple-subjects example joins in reverse order using First's Output and Second's Output. These possessives select members without redeclaring their owners. Native Output/Error needs an actual App; a static type namespace alone has no invocation.

demo/paragraphs/fallthrough.l
Use IO's Print from `io` as "Print".
"firstText" is `First`.
"secondText" is `Second`.
Create "First" as a New Public Basic App.
The App Prints firstText.
Define "result" as First's Output.
Show result.
Create "Second" as a New Public Basic App.
The App Prints secondText.
Define "result" as Second's Output.
Show result.
Execute First and Second.
Show `done`.

Complete program. Source: demo/paragraphs/fallthrough.l.

Example evidence

Sequential Execute actions activate local continuations. existing-witness-not-run. Evidence guide.

Here The App Prints firstText runs inside First. The following Define and Show form its continuation: orchestrator actions deferred until the invocation's first Await joins it. The Second paragraph works the same way.

Execute First and Second starts and awaits First, runs First's continuation, then does the same for Second. Finally Show writes done; expected stdout is First\nSecond\ndone. Repeated Await returns the finalized result without repeating the continuation. A new invocation gets fresh continuation storage; an ordinary paragraph executes when reached.

A value must be assigned on every continuing path before use. Assignment in one conditional branch does not establish it on another; an Exit branch no longer continues. Output readiness is checked at runtime even when names and types resolve.

See scope ownership, paragraph examples, and the specification. Next, define new vocabulary.