-
Notifications
You must be signed in to change notification settings - Fork 0
Assertions
Especially during debugging, but even in production code, assertions make it possible to catch a bug and stop further execution while providing useful diagnostic information.
The form is:
>>> <predicate> "<message>"
From the Building class in an elevator application
>>> /R48/Floor "Building {Name} has no floors"
If the above action is executed by an instance of Building, and there is not at least one related Floor instance, a fatal exception will be thrown along with default diagnostic information.
The default diagnostic information indicates the exact location of the assert statement that triggered the exception and the predicate that failed. The values of any attributes or variables can be supplied between {} brackets. Since they appear between quotes, the variable brackets won’t be confused with action grouping brackets.
Copyright 2020, 2021, 2022, 2023, 2025 © Leon Starr under MIT Open Source License
- Why they are problematic
- Instance attribute creation values
- Boolean values
- Special values
- Enumerated values
- Action block
- Statement
- Single line action
- Multiple dependent actions on a single line
- An action spread across multiple lines
- A conditional group of single line actions
- Comments
- Finding instances
- Attribute access
- Creation and deletion
- Subclass migration
- Creating a table from a class
- Creating a table with a definition
- Converting a table into a class
- Set operations on tables
- Set comparisons on tables
- Join
- Rename
- Extend
- Aggregation
- Rank
- Image
- Input values
- Signatures and name doubling
- Output values
- Execution order
- Sequential execution
- Conditional execution
- Signals
- Scrall has no for_each action
- Iteration