DOCS/LANGUAGE/POLYGLOT BLOCKS

Chapter 04

Give every runtime a role.

Embed ordinary language code inside explicit tags. Block reads the boundary, starts the native runtime and carries compatible workflow state forward.

MODELSEQUENTIALBOUNDARYEXPLICITRUNTIMESEDITION-BASED
04.1

Language tags

Each embedded stage uses an XML-style opening and closing tag. The supported set depends on your edition.

LITE / CORE

PY<py>JS<js>HTML<html>

STANDARD

PHP<php>LUA<lua>SQL<sqlite>

BLOCK+ / EXPANDED

RS<rust>GO<go>C++<cpp>ZIG<zig>PS<ps>JAVA<java>
04.2

Shared workflow state

When a language stage completes, selected compatible values can return to the orchestrator and become available to the following stage.

PYTHONrecords[]STAGE COMPLETE
MASK / SERIALIZE / INJECT
NODE.JSrecords[]STATE RECEIVED
Shared state is a transfer, not shared physical memory.

Separate native processes retain separate execution contexts. The orchestrator prepares compatible values at each boundary.

04.3

Python to JavaScript

report.blk
counter = 100

<py>
records = [12, 18, 21, 27]
average = sum(records) / len(records)
counter = counter + len(records)
</py>

<js>
const summary = {
  count: counter,
  average,
  generatedAt: new Date().toISOString()
};
console.log(JSON.stringify(summary));
</js>
01Native value02Python stage03State bridge04Node.js stage
04.4

Rules inside a block

01

Write ordinary language code

Inside a runtime block, follow that language's syntax, indentation and library conventions.

02

Keep tags balanced

Every opening runtime tag must have a matching closing tag.

03

Respect transfer compatibility

Prefer clear scalar and structured values when state needs to cross a runtime boundary.

04

Follow execution order

A later stage can use completed earlier state; an earlier stage cannot read a future result.