Lispex Settlement.Semantic Failure(Lispex Condition)- Модуль
- std.
lispex → - Получатель
- Неприменимо
- Минимальное число аргументов
- 1
- Максимальное число аргументов
- 1
Declaration and parameters
СсылкаДоступность
Включено по умолчанию · Нет
Import std.lispex from an application package with a verified lock. Packages with [lispex] require --locked. Application profile topaz/ uses evaluator profile lispex/. Application profile topaz/ uses evaluator profile lispex/.
The generated-module resolver gate starts at language mode 5.18. Compatibility of this API with earlier released editions remains Pending. Target deployment conditions are native (native-only), web (web-isolated-workers), web- (web-isolated-workers). Runtime payload follows checker-reached rules. An empty reached-rule set includes no runtime payload. Application quotas are required. Lock-only packages do not receive these application modules.
Получатель
Ограничения параметров
evaluate(rule, input, limits) returns Result<LispexEvaluation, LispexAttemptError>. It submits the immutable prepared program, one canonical input value, and the complete declared evaluation limits. It snapshots caller owned data before entry and performs no external action on behalf of the guest.
Ok contains a completed evaluation even when the rule fails. LispexEvaluation.request records the verified semantic request and its identity. LispexEvaluation.settlement records the completed canonical outcome of that request. The result carries no successful value when its settlement is a failure.
LispexSettlement.Complete(value) contains exactly one canonical LispexValue. A false Boolean or an application value named deny or review remains a successful language result. The adapter neither interprets that value as a host command nor performs an external action.
LispexSettlement.SemanticFailure(condition) records an uncaught deterministic language or domain failure. The condition retains its stable phase, stable code, typed canonical parameters, and canonical failure site. Returning a procedure or multiple values across the single Datum result boundary cannot produce Complete.
LispexSettlement.LimitExhaustion(condition) records a deterministic stop under the selected evaluation resource model and limits. Its condition identifies the first exhausted resource axis and canonical failure site. It preserves the first cause and returns no successful result prefix.
A LispexCondition identifies a failure through its phase and stable code together. Its parameters retain their canonical types and values. Its site follows the selected canonical site contract. A resource condition also carries the exhausted axis required by that contract.
Translated messages, source coordinates, host paths, and displayed stacks are diagnostic presentation. They do not replace condition parameters or alter the canonical settlement. A code or human message alone is insufficient to compare failures.
LispexAttemptError.Admission(report) reports a refused submission. The report records the submitted request data and identities verified before refusal. Admission refusal produces neither a canonical evaluation outcome nor an evaluation receipt.
LispexAttemptError.Interrupted(fault) reports a host interruption that prevented evaluation completion. Cancellation, a host deadline, or loss of host resources cannot be relabeled as a deterministic Lispex limit stop. The attempt supplies no canonical evaluation outcome or evaluation receipt.
LispexAttemptError.EngineDefect(report) identifies an evaluator defect that prevented a conforming completed evaluation. It remains distinct from an admitted program's language failure. The attempt supplies no canonical evaluation outcome or evaluation receipt.
A boundary report states its stage and stable reason with named presentation fields. It cites only identities already verified at that stage. It does not synthesize a canonical input, program identity, evaluation request identity, or failure site that validation has not established.
A preparation read or normalization failure before canonical code exists produces a report bound to the exact submitted source. It stops before entry evaluation. Source locations in that report describe the supplied source and do not claim a canonical evaluation location.
Canonical input decoding and canonical result or failure encoding remain evaluation work. A deterministic resource stop during those evaluation events is LimitExhaustion. Whether the guest entry was called does not by itself determine the outcome class.
A lexical guest guard can recover from ordinary runtime and domain conditions under the Lispex condition contract. Preparation, admission, resource, operational, and internal failures remain outside guest recovery. Resource exhaustion runs no guest recovery or cleanup and preserves its first cause.
Every call starts a fresh evaluation account. Reusing a prepared rule preserves its program while supplying an independent input and declared budget. An earlier value, failure, or host cache state cannot become hidden input to a later evaluation.
A conforming execution of the same admitted semantic request produces the same Complete value or the same complete failure condition. The comparison includes the phase, code, typed parameters, canonical site, and resource axis when present. It excludes host execution observations.
Deterministic language failures and evaluation resource stops remain eligible for portable receipts and exact replay. An outer attempt error does not become a receipt eligible settlement merely because its report is structured or reproducible.
SemanticFailure carries resource as None(). LimitExhaustion carries Some of the first exhausted axis. Channel names identify the input, result or diagnostics channel declared by the selected versioned model. They are not locale dependent messages.
Each evaluation performs the required guest and module initialization under its evaluation budget before the selected entry runs. A reused prepared handle contains no guest state from an earlier call. Preparation performs no guest computation.
Validate the evaluation limit record and supported contract before entry. A canonical input whose codec or contract differs from the prepared rule produces Admission. A valid handle does not permit a caller to reinterpret its bytes under another codec.
Связанное правило · Read a completed evaluation and preserve its failure class →Результат
Эффекты
Ошибки
Result and effects
СсылкаPreserve a deterministic language condition after guest recovery ends.
Why
СсылкаThe outcomes contract gives this operation one explicit input boundary and preserves the distinct result and failure cases.
Resolved contracts
СсылкаRelated entries
СсылкаRead a completed evaluation and preserve its failure class
СсылкаRead a completed evaluation and preserve its failure class
evaluate(rule, input, limits) returns Result<LispexEvaluation, LispexAttemptError>. It submits the immutable prepared program, one canonical input value, and the complete declared evaluation limits. It snapshots caller owned data before entry and performs no external action on behalf of the guest.
Ok contains a completed evaluation even when the rule fails. LispexEvaluation.request records the verified semantic request and its identity. LispexEvaluation.settlement records the completed canonical outcome of that request. The result carries no successful value when its settlement is a failure.
LispexSettlement.Complete(value) contains exactly one canonical LispexValue. A false Boolean or an application value named deny or review remains a successful language result. The adapter neither interprets that value as a host command nor performs an external action.
LispexSettlement.SemanticFailure(condition) records an uncaught deterministic language or domain failure. The condition retains its stable phase, stable code, typed canonical parameters, and canonical failure site. Returning a procedure or multiple values across the single Datum result boundary cannot produce Complete.
LispexSettlement.LimitExhaustion(condition) records a deterministic stop under the selected evaluation resource model and limits. Its condition identifies the first exhausted resource axis and canonical failure site. It preserves the first cause and returns no successful result prefix.
A LispexCondition identifies a failure through its phase and stable code together. Its parameters retain their canonical types and values. Its site follows the selected canonical site contract. A resource condition also carries the exhausted axis required by that contract.
Translated messages, source coordinates, host paths, and displayed stacks are diagnostic presentation. They do not replace condition parameters or alter the canonical settlement. A code or human message alone is insufficient to compare failures.
LispexAttemptError.Admission(report) reports a refused submission. The report records the submitted request data and identities verified before refusal. Admission refusal produces neither a canonical evaluation outcome nor an evaluation receipt.
LispexAttemptError.Interrupted(fault) reports a host interruption that prevented evaluation completion. Cancellation, a host deadline, or loss of host resources cannot be relabeled as a deterministic Lispex limit stop. The attempt supplies no canonical evaluation outcome or evaluation receipt.
LispexAttemptError.EngineDefect(report) identifies an evaluator defect that prevented a conforming completed evaluation. It remains distinct from an admitted program's language failure. The attempt supplies no canonical evaluation outcome or evaluation receipt.
A boundary report states its stage and stable reason with named presentation fields. It cites only identities already verified at that stage. It does not synthesize a canonical input, program identity, evaluation request identity, or failure site that validation has not established.
A preparation read or normalization failure before canonical code exists produces a report bound to the exact submitted source. It stops before entry evaluation. Source locations in that report describe the supplied source and do not claim a canonical evaluation location.
Canonical input decoding and canonical result or failure encoding remain evaluation work. A deterministic resource stop during those evaluation events is LimitExhaustion. Whether the guest entry was called does not by itself determine the outcome class.
A lexical guest guard can recover from ordinary runtime and domain conditions under the Lispex condition contract. Preparation, admission, resource, operational, and internal failures remain outside guest recovery. Resource exhaustion runs no guest recovery or cleanup and preserves its first cause.
Every call starts a fresh evaluation account. Reusing a prepared rule preserves its program while supplying an independent input and declared budget. An earlier value, failure, or host cache state cannot become hidden input to a later evaluation.
A conforming execution of the same admitted semantic request produces the same Complete value or the same complete failure condition. The comparison includes the phase, code, typed parameters, canonical site, and resource axis when present. It excludes host execution observations.
Deterministic language failures and evaluation resource stops remain eligible for portable receipts and exact replay. An outer attempt error does not become a receipt eligible settlement merely because its report is structured or reproducible.
SemanticFailure carries resource as None(). LimitExhaustion carries Some of the first exhausted axis. Channel names identify the input, result or diagnostics channel declared by the selected versioned model. They are not locale dependent messages.
Each evaluation performs the required guest and module initialization under its evaluation budget before the selected entry runs. A reused prepared handle contains no guest state from an earlier call. Preparation performs no guest computation.
Validate the evaluation limit record and supported contract before entry. A canonical input whose codec or contract differs from the prepared rule produces Admission. A valid handle does not permit a caller to reinterpret its bytes under another codec.
Причина
A caller must distinguish a completed rule decision from a request that never produced a canonical evaluation outcome. Typed conditions preserve the same meaning across products and presentation settings. Keeping admission and operational attempts outside LispexSettlement prevents a report from masquerading as a replayable rule result.
Return a language failure as an outcome
Ссылкаimport std.bytes { Bytes }import std.ioimport std.testimport std.lispex {LispexPackage,LispexBoundaryReport,LispexLimitPreset,LispexLimits,LispexSource,LispexSourceBundle,PreparedLispexRule,LispexPreparationError,LispexDatumView,LispexValue,LispexValueError,LispexEvaluation,LispexAttemptError,LispexSettlement,applicationPackage,defaultLimits,prepare,valueFromDatum,canonicalBytes,evaluate,}export function main(args: Array<string>, stdin: string) -> Result<int, string> {let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()let application: LispexPackage = test.assertOk(packageResult)let preset: LispexLimitPreset = defaultLimits()let source: LispexSource = LispexSource {name: "main",source: "(module main (import) (export rule) (entry rule) (define rule (lambda (input) (+ input 1))))\n".encodeUtf8(),}let bundle: LispexSourceBundle = LispexSourceBundle {modules: [source],root: "main",}let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)let rule: PreparedLispexRule = test.assertOk(prepared)let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(true), preset.host)let input: LispexValue = test.assertOk(converted)let attempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)let evaluation: LispexEvaluation = test.assertOk(attempt)match (evaluation.settlement) {case SemanticFailure(_) => io.writeLine("language failure")case _ => io.writeLine("unexpected outcome")}return Ok(0)}
language failure
Ожидаемый результат
Ожидаемый результат
Выполнение завершается. Код завершения 0.
language failure
Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.
Distinguish interrupted attempts from completed failures
Ссылкаimport std.lispex { LispexAttemptError, LispexOperationalFault, LispexSettlement, LispexResourceAxis }function attemptReason(error: LispexAttemptError) -> string {return match (error) {case Admission(report) => report.codecase Interrupted(fault) => match (fault) {case Cancelled() => "cancelled"case DeadlineExceeded() => "deadline"case SafetyPreemption() => "physical safety"}case EngineDefect(report) => report.code}}function resource(outcome: LispexSettlement) -> Option<LispexResourceAxis> {return match (outcome) {case Complete(value) => None()case SemanticFailure(condition) => condition.resourcecase LimitExhaustion(condition) => condition.resource}}export function main(args: Array<string>, stdin: string) -> Result<int, string> {return Ok(0)}
Нет стандартного вывода.Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
Check this source in the verified application fixture. Host interruption has no canonical settlement. A completed deterministic failure remains inside LispexEvaluation.