Scope

Sections are denoted by the § symbol followed by the section title. Subsections can be created by repeating the § symbol.

§ Section Title
§§ Subsection Title
§§§ Sub-subsection Title

This mechanism creates lexical scope.

Scope gives us the fine grain needed to encode legal expressions like "For the purposes of sections 2 and 3(a), tomato means ..."

Quoted Section Names

Section names can contain spaces and special characters when enclosed in backticks:

§ `Section Alpha`
§§ `Subsection with spaces`

Referencing Entities Across Sections

Entities defined in one section can be referenced from another section using qualified names.

Unqualified References

When sections are siblings (at the same level), entities from one section are visible in other sections without qualification:

§ `Section A`
sharedValue MEANS 42

§ `Section B`
-- sharedValue is visible here without qualification
result MEANS sharedValue PLUS 1

Qualified References with Dot Notation

You can explicitly qualify a reference with its section path using dot notation:

For nested sections, chain the section names:

Genitive Syntax ('s)

L4 supports an alternative genitive syntax using 's (apostrophe-s), which reads more naturally in legal English:

The genitive syntax is equivalent to dot notation and can be mixed:

When to Use Qualified References

Qualified references are useful when:

  1. Disambiguation: Two sections define entities with the same name

  2. Clarity: Making the source of a value explicit in complex documents

  3. Cross-references: Mirroring legal language like "the value defined in Section 2(a)"

Section Aliases

Sections can have aliases using the AKA keyword. Aliases provide shorter names that can be used in qualified references:

Last updated