conformance: document narrow-int unification (byte/short/int -> Long)
jolt unifies every integer as one exact-integer type, so (byte/short/int n) report Long not Byte/Short/Integer and instance? Byte is false. Confirmed substrate-inherent: (byte 5) is a Chez immediate identical? to 5 (nothing to tag, numbers carry no metadata), and arithmetic compiles to a raw Chez + that a boxed narrow type would crash. Value/arithmetic/equality are correct. Certify the value-correctness (= to plain int, arithmetic promotes, is a Number) and pin the class/instance? divergence under a new :integer-box-model category. Data/doc only.
This commit is contained in:
parent
59cfa5f53f
commit
4a72897dfd
3 changed files with 37 additions and 2 deletions
|
|
@ -119,6 +119,19 @@ allowlisted in `known-divergences.edn`:
|
|||
chunk. Strictly finer-grained laziness, decided after the chunk fast path
|
||||
(jolt-j9dz) was made O(n).
|
||||
|
||||
## Narrow integer types
|
||||
|
||||
jolt unifies every integer as one exact-integer type (`:integer-box-model`,
|
||||
jolt-k9sw). `(byte n)`/`(short n)`/`(int n)` produce value-correct integers —
|
||||
arithmetic, `=`, and `hash` behave exactly as the JVM — but report `Long`, not
|
||||
`Byte`/`Short`/`Integer`, so `(class (byte 5))` and `(instance? Byte (byte 5))`
|
||||
diverge. This is substrate-inherent: a Chez fixnum is an immediate `identical?`
|
||||
to the plain integer (nothing to tag, and numbers carry no metadata), so the only
|
||||
faithful representation is a boxed type — which would crash raw compiled `(+ …)`
|
||||
(arithmetic emits a bare Chez `+`) or force every `+`/`-`/`*` through an
|
||||
unwrapping dispatcher, de-optimizing all arithmetic. Same shape as the accepted
|
||||
BigInt-vs-Long unification.
|
||||
|
||||
## Hosting jolt on a new runtime
|
||||
|
||||
1. Implement the reader + analyzer + a backend for your runtime (see the Chez port
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue