Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes in "Modules" section of 1.1 spec #380

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions _books/ion-1-1/src/modules/defining_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The symbol table is a list of symbol-texts by concatenating the symbol tables of

Where a module name occurs, its symbol table is appended.
(The module name must refer to another module that is visible to the current module.)
Unlike Ion 1.0, no _symbol-maxid_ is needed because Ion 1.1 always required exact matches for imported modules.
Unlike Ion 1.0, no _symbol-maxid_ is needed because Ion 1.1 always requires exact matches for imported modules.

> [!TIP]
> When redefining a top-level module binding,
Expand Down Expand Up @@ -158,7 +158,7 @@ All modules have a symbol table, so when a module has no `symbol_table` clause,


Symbol zero (i.e. `$0`) is a special symbol that is not assigned text by any symbol table, even the system symbol table.
Symbol zero always has unknown text, and can be useful in synthesizing symbol identifiers where the text image of the symbol is not known in a particular operating context.
Symbol zero always has unknown text, and can be useful in synthesizing symbol identifiers where the text of the symbol is not known in a particular operating context.

All symbol tables (even an empty symbol table) can be thought of as implicitly containing `$0`.
However, `$0` precedes all symbol tables rather than belonging to any symbol table.
Expand Down Expand Up @@ -218,8 +218,16 @@ Macros are declared after symbols.
The `macro_table` clause assembles a list of macro definitions for the module to export. It takes any number of arguments.
All modules have a macro table, so when a module has no `macro_table` clause, the module has an empty macro table.

Most commonly, a macro table entry is a definition of a new macro expansion function, following
this general shape:
Most commonly, a macro table entry is a definition of a new macro expansion function, following this general shape:

```ion
// ┌─── `macro` keyword
// │ ┌─── macro name
// │ │ ┌─── signature (s-expression of parameters)
// │ │ │ ┌─── template (TDL expression)
(macro foo (x y z) (.values (%x) (%y) (%z))
```
(See the [_Defining macros_](../macros/defining_macros.md) for details.)

When no name is given, this defines an anonymous macro that can be referenced by its numeric
address (that is, its index in the enclosing macro table).
Expand Down Expand Up @@ -278,8 +286,7 @@ An `export` clause declares a name for an existing macro and appends the macro t
An error must be signaled if that name already appears in the exported macro array.
* If the reference to the existing macro is followed by `null`, the macro is appended to the exported macro array
without a name, regardless of whether the macro has a name.
* If the reference to the existing macro is anonymous, the macro is appended to the exported macro array without
a name.
* If the reference to the existing macro is anonymous, the macro is appended to the exported macro array without a name.
* When the reference to the existing macro uses a name, the name and macro are appended to the exported macro
array. An error must be signaled if that name already appears in the exported macro array.

Expand Down