Behavior Layer Reference¶
State machines and workflows in USL.
Behavior Definition¶
behavior OrderLifecycle for Order {
initial state Pending
state Pending {
on confirm -> Confirmed
}
state Confirmed {
// ...
}
}
Transitions¶
Basic Transition¶
With Guards¶
With Effects¶
With Events¶
Nested States¶
state Active {
state Working {
on pause -> Paused
}
state Paused {
on resume -> Working
}
on deactivate -> Inactive
}
Parallel States¶
parallel state Processing {
region Payment {
state PendingPayment
state Paid
}
region Shipping {
state PendingShipment
state Shipped
}
}
Verification¶
USL verifies: - All transitions preserve invariants - Initial state is valid - No unreachable states - Deterministic transitions