syntax.attempt_placement
Attempt is used inside an expression.
Area 3, Logic; not declinable; the next step is usually the agent's.
attempt only starts a statement, so every early exit is at the start of a line:
type Count = Int { min: 0 max: 1000}type TooBig = Failure { kind: FailureKind.invalid_value}function checked(count: Count) fails TooBig -> Count { if (count > 500) { reject TooBig } return count}function doubled(count: Count) fails TooBig -> Count { return Count(attempt checked(count) * 2)}
error attempt can only start a statement
--> main.jadpo:18:18
|18 | return Count(attempt checked(count) * 2) | ^^^^^^^ inside an expression
- reason
- Every place a callable can stop early is at the start of a line: a
var, an assignment, areturn, or a statement of its own. - next
- Move the call into its own
varstatement withattempt, then use the variable (agent) - rule
- syntax.
attempt_ placement - help
- https://jadpo.
dev/docs/errors/syntax. attempt_ placement
Markdown for agents: /docs/errors/syntax.attempt_placement.md.Built from Jadpo main at aee2e8f.