default Limits() - > Lispex Limit Preset- Module
- std.
lispex - Receiver
- Not applicable
- Minimum arity
- 0
- Maximum arity
- 0
Declaration and parameters
LinkAvailability
Included by default: no
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.
Source evidence
- compiler/contracts/lispex-application/v1/std.lispex.tpz at
b48527d0a174· 115 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 202 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 202 - compiler/crates/topaz_resolve/src/lib.rs at
b48527d0a174· 801 - compiler/crates/topaz_cli/src/package/target.rs at
b48527d0a174· 71 - compiler/crates/topaz_value/src/lispex_application.rs at
b48527d0a174· 11 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 739 - compiler/crates/topaz_lispex_product/src/full_product.rs at
b48527d0a174· 44 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 634 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 496 - compiler/crates/topaz_lispex_product/src/full_product.rs at
b48527d0a174· 356
Receiver
Parameter constraints
LispexLimits contains the six named int fields work, logicalAllocation, semanticFrames, input, result, and diagnostics. LispexPreparationLimits and LispexHostLimits contain the same six named fields in their independent accounting domains. Every field is required and has no implicit unlimited form.
Each limit is a nonnegative Topaz int within the selected contract's supported representation bounds. Zero is an explicit finite bound and is never replaced by a default. Negative values, overflow, missing required fields, and unknown fields are refused before the affected operation begins.
The work field bounds cumulative normative computation. Native arithmetic, traversal, source processing, decoding, and encoding retain the charges assigned by their selected phase and contract. Host elapsed time and machine instruction counts do not replace work accounting.
The logicalAllocation field bounds cumulative logical allocation, including intermediate values. Sharing, garbage collection, and returning from a call do not refund committed charges. Physical allocation behavior does not change a logical charge.
The semanticFrames field bounds active semantic control state under the selected contract. A guest tail call replaces its current call frame. Nontail calls and active guard control consume their declared frames. Host stack layout does not redefine this budget.
The input, result, and diagnostics fields bound their respective channels in units defined by the selected versioned contract. The field names do not promise byte units. Preparation and host operations apply the channel meanings declared by their own contracts.
defaultLimits() returns LispexLimitPreset with preparation, evaluation, and host records. The preparation and evaluation records use the published common finite preset shared with Lispex 2.0 products. The host record uses the declared finite host work preset. The call returns complete values and performs no guest evaluation or discovery.
A preset selection is resolved before admission and execution. The request records the effective declared evaluation limits. Copying a preset and changing one field creates an explicit new selection. No invalid field is repaired from a preset and no host silently reduces the selection.
Preparation uses its own finite account for the closed source bundle. Evaluation starts a new account for the immutable prepared program and supplied input. Warm caches and reused preparation cannot move work into the evaluation account, increase its allowance, or change its normative charges.
Package admission, value conversion, artifact inspection, replay validation, authentication and additional profile checks use the separate finite host account assigned to each operation. Transported prepared rule validation uses the explicit preparation account. Their host limits cannot serve as an unlimited fallback for guest work.
Canonical input decoding and canonical result or failure encoding remain evaluation work. Additional profile schema and evidence checks remain host work. A host helper that validates or retains data in advance does not remove the evaluation's declared logical events or charges.
At each atomic resource event, check work first, logicalAllocation next, semanticFrames next, and the applicable channel last. Skip axes the event does not require. An event reserves at most its declared semantic channel and work across several channels follows the contract's event sequence.
Commit an event's charges and effect only after every required reservation succeeds. If one reservation fails, perform none of that event's effect or charges. Retain charges committed by earlier events. Releasing an active frame does not refund cumulative work or allocation.
A reservation accepts a resulting charge equal to its limit. It rejects a resulting charge above the limit before the effect. Accounting uses checked exact arithmetic and cannot wrap or vary with host word size.
Checks and reservations follow semantic event order. A later charge cannot hide an earlier domain failure. Work needed to reach or perform an earlier check can itself exhaust a budget before that check completes.
Optimizations, inlining, native fast paths, and constant sharing preserve normative events and their first observable failure. They preserve the exhausted axis and canonical site for the same admitted semantic request. Equal aggregate usage totals alone do not establish this requirement.
A result channel failure returns no successful result prefix. Diagnostic production obeys its finite channel budget, and terminal reporting uses the reserved emergency representation defined by the selected contract. Optional tracing cannot change the canonical outcome when its own capacity is exhausted.
The host admits a request only when its physical envelope can support the selected logical limits. It refuses unsupported envelopes without lowering the request budget or choosing another engine. A later physical failure remains operational or defective execution and cannot be relabeled as deterministic guest exhaustion.
A deterministic evaluation limit stop returns LimitExhaustion with the first exhausted axis and canonical site. A preparation resource stop remains a preparation failure report. An additional profile host budget refusal remains an admission or profile work report according to its stage.
Host work after a completed evaluation preserves that evaluation when its own budget is exhausted. It can refuse qualification, evidence creation, validation, or authentication without replacing the guest settlement or changing the original evaluation request identity.
Replaying a request uses the same resource model and complete evaluation limit record. A different declared limit record is a request mismatch even when the observed value would be unchanged. Host verification and comparison budgets remain separately identified.
Tariff coefficients, logical allocation units, detailed frame charges, channel units, finite default numbers, emergency capacities, and physical envelope requirements come from their versioned Lispex 2.0 contracts. This binding does not infer them from Lispex 1.x counters or current public product observations.
Missing and unknown named record fields are Topaz checking errors before a call is formed. A negative field or an unsupported representable value in a complete record causes the typed preflight refusal of the called operation. Neither path repairs the record or begins its phase.
Related rule: Apply finite budgets in the declared resource orderResult
The declared result type is Lispex.
Effects
Failures
Result and effects
LinkRead the common finite preset for the selected Lispex 2.0 contract.
Why
LinkThe limits contract gives this operation one explicit input boundary and preserves the distinct result and failure cases.
Resolved contracts
LinkRelated entries
LinkApply finite budgets in the declared resource order
LinkApply finite budgets in the declared resource order
LispexLimits contains the six named int fields work, logicalAllocation, semanticFrames, input, result, and diagnostics. LispexPreparationLimits and LispexHostLimits contain the same six named fields in their independent accounting domains. Every field is required and has no implicit unlimited form.
Each limit is a nonnegative Topaz int within the selected contract's supported representation bounds. Zero is an explicit finite bound and is never replaced by a default. Negative values, overflow, missing required fields, and unknown fields are refused before the affected operation begins.
The work field bounds cumulative normative computation. Native arithmetic, traversal, source processing, decoding, and encoding retain the charges assigned by their selected phase and contract. Host elapsed time and machine instruction counts do not replace work accounting.
The logicalAllocation field bounds cumulative logical allocation, including intermediate values. Sharing, garbage collection, and returning from a call do not refund committed charges. Physical allocation behavior does not change a logical charge.
The semanticFrames field bounds active semantic control state under the selected contract. A guest tail call replaces its current call frame. Nontail calls and active guard control consume their declared frames. Host stack layout does not redefine this budget.
The input, result, and diagnostics fields bound their respective channels in units defined by the selected versioned contract. The field names do not promise byte units. Preparation and host operations apply the channel meanings declared by their own contracts.
defaultLimits() returns LispexLimitPreset with preparation, evaluation, and host records. The preparation and evaluation records use the published common finite preset shared with Lispex 2.0 products. The host record uses the declared finite host work preset. The call returns complete values and performs no guest evaluation or discovery.
A preset selection is resolved before admission and execution. The request records the effective declared evaluation limits. Copying a preset and changing one field creates an explicit new selection. No invalid field is repaired from a preset and no host silently reduces the selection.
Preparation uses its own finite account for the closed source bundle. Evaluation starts a new account for the immutable prepared program and supplied input. Warm caches and reused preparation cannot move work into the evaluation account, increase its allowance, or change its normative charges.
Package admission, value conversion, artifact inspection, replay validation, authentication and additional profile checks use the separate finite host account assigned to each operation. Transported prepared rule validation uses the explicit preparation account. Their host limits cannot serve as an unlimited fallback for guest work.
Canonical input decoding and canonical result or failure encoding remain evaluation work. Additional profile schema and evidence checks remain host work. A host helper that validates or retains data in advance does not remove the evaluation's declared logical events or charges.
At each atomic resource event, check work first, logicalAllocation next, semanticFrames next, and the applicable channel last. Skip axes the event does not require. An event reserves at most its declared semantic channel and work across several channels follows the contract's event sequence.
Commit an event's charges and effect only after every required reservation succeeds. If one reservation fails, perform none of that event's effect or charges. Retain charges committed by earlier events. Releasing an active frame does not refund cumulative work or allocation.
A reservation accepts a resulting charge equal to its limit. It rejects a resulting charge above the limit before the effect. Accounting uses checked exact arithmetic and cannot wrap or vary with host word size.
Checks and reservations follow semantic event order. A later charge cannot hide an earlier domain failure. Work needed to reach or perform an earlier check can itself exhaust a budget before that check completes.
Optimizations, inlining, native fast paths, and constant sharing preserve normative events and their first observable failure. They preserve the exhausted axis and canonical site for the same admitted semantic request. Equal aggregate usage totals alone do not establish this requirement.
A result channel failure returns no successful result prefix. Diagnostic production obeys its finite channel budget, and terminal reporting uses the reserved emergency representation defined by the selected contract. Optional tracing cannot change the canonical outcome when its own capacity is exhausted.
The host admits a request only when its physical envelope can support the selected logical limits. It refuses unsupported envelopes without lowering the request budget or choosing another engine. A later physical failure remains operational or defective execution and cannot be relabeled as deterministic guest exhaustion.
A deterministic evaluation limit stop returns LimitExhaustion with the first exhausted axis and canonical site. A preparation resource stop remains a preparation failure report. An additional profile host budget refusal remains an admission or profile work report according to its stage.
Host work after a completed evaluation preserves that evaluation when its own budget is exhausted. It can refuse qualification, evidence creation, validation, or authentication without replacing the guest settlement or changing the original evaluation request identity.
Replaying a request uses the same resource model and complete evaluation limit record. A different declared limit record is a request mismatch even when the observed value would be unchanged. Host verification and comparison budgets remain separately identified.
Tariff coefficients, logical allocation units, detailed frame charges, channel units, finite default numbers, emergency capacities, and physical envelope requirements come from their versioned Lispex 2.0 contracts. This binding does not infer them from Lispex 1.x counters or current public product observations.
Missing and unknown named record fields are Topaz checking errors before a call is formed. A negative field or an unsupported representable value in a complete record causes the typed preflight refusal of the called operation. Neither path repairs the record or begins its phase.
Why
Complete named records make a resource request explicit and reproducible. Separate preparation, evaluation, and host budgets prevent cache behavior or extra profile checks from changing guest meaning. Ordered reservations and atomic effects ensure that every conforming product reports the same first semantic stop.
Source evidence
- docs/content-next/en/resources.json at
f455ac95ab30· 1 - docs/content-next/en/embedding.json at
f455ac95ab30· 1 - docs/content-next/en/profiles.json at
f455ac95ab30· 1 - docs/content-next/en/cli-and-diagnostics.json at
f455ac95ab30· 1 -
topaz.stdlib.contract.lispex-limitsatworking-tree - topaz.decision.lispex-v2-limits.1 at
topaz.decisi
Complete with a resource failure at zero work
Linkimport 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: "source.scm",bytes: "(define rule (lambda (input) (let loop () (loop))))\n".encodeUtf8(),}let bundle: LispexSourceBundle = LispexSourceBundle {entryModule: "source.scm",entryBinding: "rule",sources: [source],}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 zeroWork: LispexLimits = LispexLimits {work: 0,logicalAllocation: preset.evaluation.logicalAllocation,semanticFrames: preset.evaluation.semanticFrames,input: preset.evaluation.input,result: preset.evaluation.result,diagnostics: preset.evaluation.diagnostics,}let attempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, zeroWork)let evaluation: LispexEvaluation = test.assertOk(attempt)match (evaluation.settlement) {case LimitExhaustion(_) => io.writeLine("resource failure")case _ => io.writeLine("unexpected outcome")}return Ok(0)}
resource failure
Expected result
Expected result
Execution completes. Exit code 0.
resource failure
Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.
Source evidence
- docs/content-next/en/resources.json at
f455ac95ab30· 1 - docs/content-next/en/embedding.json at
f455ac95ab30· 1 - docs/content-next/en/profiles.json at
f455ac95ab30· 1 - docs/content-next/en/cli-and-diagnostics.json at
f455ac95ab30· 1 -
topaz.stdlib.contract.lispex-limitsatworking-tree - topaz.decision.lispex-v2-limits.1 at
topaz.decisi