Lispex Value Error.Limit Exceeded(Lispex Boundary Report)- 수신자
- 해당 없음
- 최소 인자 수
- 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.
수신자
매개변수 제약
LispexValue is an immutable validated Datum handle. Its codec identity travels with the value. Guest inputs and successful results use this same representation. Equality follows the selected canonical value contract.
valueFromCanonical accepts an admitted package, immutable bytes and complete finite host limits. Decode exactly one complete canonical Datum under the package codec. Reject malformed bytes, trailing values, unsupported versions and noncanonical representations as InvalidCanonicalValue.
valueFromDatum accepts a LispexDatumView and creates a detached immutable snapshot. Boolean accepts a bool. Number accepts exact BigInt numerator and denominator values and normalizes their rational value. A zero denominator returns InvalidDatum. No inexact floating value is accepted.
Character accepts exactly one Unicode scalar. Empty text, several scalars and invalid scalar representations return InvalidDatum. Symbol and Text preserve their scalar sequences without normalization or case conversion. Empty symbols follow the selected Datum codec contract.
EmptyList is the empty list value. Pair holds two validated values. Vector copies its Array of validated values in order. Bytevector retains exact immutable bytes. Every child must use the same admitted codec contract. A mismatched child returns InvalidDatum before guest entry.
The exposed view has no procedure, callback or host object alternative. A procedure cannot be hidden in Pair or Vector because each child must already be a validated LispexValue. Construction does not follow host reference graphs. Mutating a source Array after conversion cannot change the sealed value.
valueView returns a detached view of the same value. Number exposes the normalized exact numerator and positive denominator. Aggregate views contain sealed child handles. Changing a returned Array changes that view and does not mutate the LispexValue.
Conversions reserve their work, allocation, traversal frames, input and result channels under LispexHostLimits. Host conversion exhaustion returns LimitExceeded with the first axis. A failure returns no prefix or partly valid value. It creates no canonical evaluation outcome or receipt.
canonicalBytes returns the immutable canonical bytes established when the handle was created. It does not decode, evaluate, discover a codec or perform fresh serialization. The handle retains that bounded representation, so reading it starts no new guest or host work account.
Host conversion work is separate from evaluation work. Evaluation still charges canonical input decoding and canonical result or failure encoding under its own limits. Prevalidated bytes cannot bypass those charges.
The same value, codec and explicit conversion limits have the same accepted canonical bytes or deterministic conversion refusal. Exact codec bytes and normalization encodings belong to the admitted versioned Lispex contract. Legacy 1.21 bytes are never relabeled as 2.0 bytes.
관련 규칙 · Exchange exact immutable Datum values →결과
효과
실패
Result and effects
링크Report exhaustion of a host conversion budget.
Why
링크The values contract gives this operation one explicit input boundary and preserves the distinct result and failure cases.
Related entries
링크Exchange exact immutable Datum values
링크Exchange exact immutable Datum values
LispexValue is an immutable validated Datum handle. Its codec identity travels with the value. Guest inputs and successful results use this same representation. Equality follows the selected canonical value contract.
valueFromCanonical accepts an admitted package, immutable bytes and complete finite host limits. Decode exactly one complete canonical Datum under the package codec. Reject malformed bytes, trailing values, unsupported versions and noncanonical representations as InvalidCanonicalValue.
valueFromDatum accepts a LispexDatumView and creates a detached immutable snapshot. Boolean accepts a bool. Number accepts exact BigInt numerator and denominator values and normalizes their rational value. A zero denominator returns InvalidDatum. No inexact floating value is accepted.
Character accepts exactly one Unicode scalar. Empty text, several scalars and invalid scalar representations return InvalidDatum. Symbol and Text preserve their scalar sequences without normalization or case conversion. Empty symbols follow the selected Datum codec contract.
EmptyList is the empty list value. Pair holds two validated values. Vector copies its Array of validated values in order. Bytevector retains exact immutable bytes. Every child must use the same admitted codec contract. A mismatched child returns InvalidDatum before guest entry.
The exposed view has no procedure, callback or host object alternative. A procedure cannot be hidden in Pair or Vector because each child must already be a validated LispexValue. Construction does not follow host reference graphs. Mutating a source Array after conversion cannot change the sealed value.
valueView returns a detached view of the same value. Number exposes the normalized exact numerator and positive denominator. Aggregate views contain sealed child handles. Changing a returned Array changes that view and does not mutate the LispexValue.
Conversions reserve their work, allocation, traversal frames, input and result channels under LispexHostLimits. Host conversion exhaustion returns LimitExceeded with the first axis. A failure returns no prefix or partly valid value. It creates no canonical evaluation outcome or receipt.
canonicalBytes returns the immutable canonical bytes established when the handle was created. It does not decode, evaluate, discover a codec or perform fresh serialization. The handle retains that bounded representation, so reading it starts no new guest or host work account.
Host conversion work is separate from evaluation work. Evaluation still charges canonical input decoding and canonical result or failure encoding under its own limits. Prevalidated bytes cannot bypass those charges.
The same value, codec and explicit conversion limits have the same accepted canonical bytes or deterministic conversion refusal. Exact codec bytes and normalization encodings belong to the admitted versioned Lispex contract. Legacy 1.21 bytes are never relabeled as 2.0 bytes.
이유
Canonical bytes serve interchange. Datum views serve typed host construction and inspection. These are different intentions even when they describe the same value. Immutable snapshots keep host mutation from changing a request after it has been identified.
Preserve an explicit Boolean input
링크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)))\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 Complete(output) => {let expected: Bytes = canonicalBytes(input)let actual: Bytes = canonicalBytes(output)io.writeLine("{actual.toHex() == expected.toHex()}")}case _ => io.writeLine("unexpected outcome")}return Ok(0)}
true
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
true
Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.
Round trip exact values and isolate host mutations
링크import std.bigint { BigInt }import std.bytes { Bytes }import std.ioimport std.testimport std.lispex {LispexPackage, LispexBoundaryReport, LispexLimitPreset, LispexDatumView,LispexValue, LispexValueError, applicationPackage, defaultLimits,valueFromDatum, valueFromCanonical, valueView, canonicalBytes,}function conversionFailure(error: LispexValueError) -> string {return match (error) {case InvalidCanonicalValue(report) => report.codecase InvalidDatum(report) => report.codecase LimitExceeded(report) => report.code}}export function main(args: Array<string>, stdin: string) -> Result<int, string> {let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()let package: LispexPackage = test.assertOk(packageResult)let limits: LispexLimitPreset = defaultLimits()let numeratorResult: Option<BigInt> = BigInt.parse("2", 10)let denominatorResult: Option<BigInt> = BigInt.parse("4", 10)let zeroResult: Option<BigInt> = BigInt.parse("0", 10)let numerator: BigInt = test.assertSome(numeratorResult)let denominator: BigInt = test.assertSome(denominatorResult)let zero: BigInt = test.assertSome(zeroResult)let built: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.Number(numerator, denominator), limits.host)let value: LispexValue = test.assertOk(built)let bytes: Bytes = canonicalBytes(value)let decoded: Result<LispexValue, LispexValueError> = valueFromCanonical(package, bytes, limits.host)let restored: LispexValue = test.assertOk(decoded)io.writeLine("{canonicalBytes(restored).toHex() == bytes.toHex()}")let viewed: Result<LispexDatumView, LispexValueError> = valueView(value, limits.host)let view: LispexDatumView = test.assertOk(viewed)match (view) {case Number(n, d) => io.writeLine("{n.toString(10)}/{d.toString(10)}")case _ => io.writeLine("unexpected view")}let mut items: Array<LispexValue> = [value]let vectorResult: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.Vector(items), limits.host)let vector: LispexValue = test.assertOk(vectorResult)let emptyResult: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.EmptyList(), limits.host)let empty: LispexValue = test.assertOk(emptyResult)items[0] = emptylet vectorViewResult: Result<LispexDatumView, LispexValueError> = valueView(vector, limits.host)let vectorView: LispexDatumView = test.assertOk(vectorViewResult)match (vectorView) {case Vector(snapshot) => io.writeLine("{canonicalBytes(snapshot[0]).toHex() == bytes.toHex()}")case _ => io.writeLine("unexpected vector")}let invalid: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.Number(numerator, zero), limits.host)match (invalid) {case Err(InvalidDatum(report)) => io.writeLine("{report.code != ""}")case _ => io.writeLine("unexpected conversion")}let otherKinds: Array<LispexDatumView> = [LispexDatumView.Character("a"),LispexDatumView.Symbol("rule"),LispexDatumView.Pair(value, empty),LispexDatumView.Bytevector("abc".encodeUtf8()),]for datum in (otherKinds) {let convertedKind: Result<LispexValue, LispexValueError> = valueFromDatum(package, datum, limits.host)let kindValue: LispexValue = test.assertOk(convertedKind)let kindBytes: Bytes = canonicalBytes(kindValue)let decodedKind: Result<LispexValue, LispexValueError> = valueFromCanonical(package, kindBytes, limits.host)let kindCopy: LispexValue = test.assertOk(decodedKind)io.writeLine("{canonicalBytes(kindCopy).toHex() == kindBytes.toHex()}")}return Ok(0)}
true
1/2
true
true
true
true
true
true
기대 결과
기대 결과
실행을 마칩니다. 종료 코드 0.
true1/2truetruetruetruetruetrue
Use a verified Lispex application package supplied through TOPAZ_LISPEX_APPLICATION. This example specifies the Lispex 2.0 behavior. The product scope remains the public 5.21.3 observation scope.