Use these pairs when writing a graph or reading a refusal. The left column is code to diagnose, not a template. A warning still allows the graph to run.
| Rule | Refused or warned | Write instead | Diagnostic |
|---|---|---|---|
| Render an integer | data as string | string(data) | E-EXPR |
| Narrow a uint to int | data as int | (data as? int).orValue(0) | E-EXPR |
| Read an array | data[0] | data[?0].orValue("none") | E-EXPR |
| Read a map field | data.name | data.?name.orValue("none") | E-EXPR |
| Read a schemaless JSON object | out = data is Receipt | val receipt = data as? Receipt; out = receipt != null | E-EXPR |
| Initialize state | var last: string | var last: string = "" | E-EXPR |
| Test array membership | data.exists(x, x == "red") | "red" in data | E-EXPR |
| Test a map key | 1 in data | "id" in data | E-EXPR |
| Build an array | ["a"] + ["b"] | ["a", "b"] | E-EXPR |
| Test a string | data.matches("^a.*b.*c$") | data.startsWith("a") && data.contains("b") && data.endsWith("c") | E-EXPR |
| Choose when a key expires | instance = { key = data } | instance = { key = data }; lifetime = { kind = idle; max = duration("5m") } | E-LIFETIME-REQUIRED |
| Close an outbound Call | lifetime = { kind = once } | lifetime = { kind = once }; closing = { drain_for = duration("1s"); settle_for = duration("1s") } | E-INSTANCE |
| Discard a lost answer | _ => out = "failed" | _ => nothing | W-MATCH-CATCHALL |
| Mock HTTP 204 | out = "body"; exit = Completed { status = 204 } | exit = Completed { status = 204 } | E-CONTRACT-REQUIRED |
| Mock HTTP 205 | out = "body"; exit = Completed { status = 205 } | exit = Completed { status = 205 } | E-CONTRACT-REQUIRED |
| Describe a codec refusal | exit = DecodeFailed {} | exit = DecodeFailed { message = "expected a status" } | E-PORT-TYPE |
int and uint are signed and unsigned 32-bit integers. Either fits a
long; a computed long need not fit either narrower type. For an array
received at a port, even index zero might be absent. Choose a fallback only
if it means something for your application; otherwise handle null separately.
A schemaless JSON codec delivers an object as a map. If it does not fit
Receipt, receipt is null. Use is for a typed union or its case.
An HTTP timeout does not
prove that the operation failed. If you record an outcome instead of
dropping it, name each lost-answer case the warning lists before the
wildcard, even if several cases go to the same destination.
For example, this handler distinguishes an unknown outcome from a known failure:
on in match data { Completed => out = "answered" BodyTooLarge | DecodeFailed | OutcomeUnknown | ProtocolFailed | TimeoutExpired => out = "unconfirmed" _ => out = "failed"}Lifetime choices are persistent, idle, age, slot and once.
A finite owner with an outbound Connector also declares its closing budgets.
A 204 or 205 has a terminal but no body. A codec refusal carries a message
about the expected data, not a copy of the value received.
Specified, not shipped
Section titled “Specified, not shipped”| Not available | Alternative in this release |
|---|---|
The iteration macro exists | Use membership for an element or key. |
Array concatenation with + | Construct the known elements explicitly. There is no general concatenation operator. |