Advanced technical guide
When a script grows into an application, the questions change: what Syside guarantees across threads, how far expression evaluation reaches, what the formatter will and will not touch, and what survives a trip through JSON. This page gives the short answer to each, and points at the API reference pages that document them in version-accurate detail.
Learn more:
Multithreading: Considerations for multithreading
Expression evaluation: Capabilities of implemented expression evaluation
Formatting: Formatting options
JSON exports and imports Labs: JSON serialization features
Multithreading
On modern computers, multithreading is necessary to achieve high performance and Syside here is no exception. Syside supports internal and external multithreading:
Internal multithreading: Syside uses multithreading internally when loading and validating models, which is not visible to the user except for the CPU usage.
External multithreading: Syside was designed to be used in multithreaded environments. While Python still uses a global interpreter lock (GIL), there is an ongoing effort to remove it. Therefore, the Syside API already exposes necessary locks for building multithreaded applications based on Syside once Python removes the GIL.
Which documents need locking, and how the mutexes behave, is covered in Model structure and Low-level API.
Expression evaluation
Semantic resolution evaluates most arithmetic expressions and a large part of the standard library, on a read-only model. Which operators and library functions evaluate depends on the Syside version, so Expression evaluation carries the version-accurate list along with the constructor-expression and quantity behaviour.
Formatting
Syside provides an AST-based formatter that ensures consistent code style across source files. The formatter:
Enforces consistent indentation and token usage (e.g.,
:>>vsredefines)Converts in-memory models to textual syntax, even without original source text
Supports format ignore pragmas to preserve specific formatting
Note
The formatter verifies that models contain all required elements but does not validate the generated syntax.
Example of format ignore pragma usage:
package P {
part def PartDef;
// syside-format ignore
part 'my unformatted AST' : PartDef {
}
}
The pragma preserves the formatting of the AST it is attached to, while maintaining consistent indentation for the rest of the file.
JSON exports and imports Labs
Syside supports bi-directional JSON serialization, aimed at project interchange
files (.kpar). JSON covers the export options, the
deserialization limits, why a JSON from the Pilot Implementation cannot be
imported directly, and why textual notation is preferable where you have the
choice.