You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Inline (fast)**: 47-bit signed in a NaN-boxed `Val`. Range `+/-2^47` (`+/-140_737_488_355_327`). One ALU op per arithmetic, no allocation.
21
21
***Wide (slow)**: i128 in `HeapObj::LongInt`. Range `+/-2^127 - 1`. Auto-used when a literal exceeds 47-bit or inline arithmetic overflows.
22
22
23
-
Outside `+/-2^127` raises `OverflowError`. Promotion is automatic, user code doesn't see the boundary.
23
+
Outside `+/-2^127` raises `OverflowError`. Promotion is automatic; user code doesn't see the boundary.
24
24
25
25
```python
26
26
print(140737488355327) # inline, fast path
@@ -43,14 +43,14 @@ overflow
43
43
44
44
-**`pow(a, b, m)` modular**: modulus must be `< 2^63` (larger overflows i128 in the multiply). Hard cap without arbitrary-precision arithmetic.
45
45
-**No CPython-style unbounded ints**: by design, edge workloads don't need wider than 128 bits; crypto-scale math is out of scope.
46
-
-**Float vs LongInt mixing**: `==` works (LongInt -> f64), but dict/set hashing follows raw `Val` bits,`{long_int: x}` indexed by a same-magnitude float misses. Coerce explicitly.
46
+
-**Float vs LongInt mixing**: `==` works (LongInt -> f64), but dict/set hashing follows raw `Val` bits —`{long_int: x}` indexed by a same-magnitude float misses. Coerce explicitly.
47
47
48
48
### Triggering limits
49
49
50
50
```python
51
51
# Recursion depth
52
52
defloop(n):
53
-
return loop(n +1)
53
+
return loop(n +1)
54
54
55
55
try:
56
56
loop(0)
@@ -85,7 +85,7 @@ Source must be under 10 MiB; larger rejected at lex time.
85
85
| Max expression depth | 200 |
86
86
| Max instructions per chunk | 65,535 |
87
87
88
-
Prevent asymmetric DoS, small input producing an exponentially large parse tree.
88
+
Prevent asymmetric DoS: small input producing an exponentially large parse tree.
89
89
90
90
## Error types
91
91
@@ -138,7 +138,7 @@ Raised as `VmErr`; most catchable with `try` / `except`.
138
138
139
139
#### Exception hierarchy
140
140
141
-
Flat tree rooted at `BaseException -> Exception`. `except` walks parent links,`except Exception` catches `RuntimeError`, `ValueError`, `KeyError`, `AssertionError`, etc.; `except RuntimeError` catches `RecursionError`, `NotImplementedError`. `SystemExit` sits directly under `BaseException`, so `except Exception` does not catch it (use `except SystemExit` or a bare `except`).
141
+
Flat tree rooted at `BaseException -> Exception`. `except` walks parent links —`except Exception` catches `RuntimeError`, `ValueError`, `KeyError`, `AssertionError`, etc.; `except RuntimeError` catches `RecursionError`, `NotImplementedError`. `SystemExit` sits directly under `BaseException`, so `except Exception` does not catch it (use `except SystemExit` or a bare `except`).
142
142
143
143
```python
144
144
try:
@@ -157,7 +157,7 @@ caught via parent: oops
157
157
caught IndexError as Exception
158
158
```
159
159
160
-
User-defined classes don't auto-extend the built-in `BaseException` tree but support single-level inheritance among themselves,`except UserBase` catches a raised `UserSub` when `UserSub` inherits from `UserBase`. `raise X from Y` raises `X`; the cause is discarded (no `__cause__` / `__context__` chaining).
160
+
User-defined classes don't auto-extend the built-in `BaseException` tree but support single-level inheritance among themselves:`except UserBase` catches a raised `UserSub` when `UserSub` inherits from `UserBase`. `raise X from Y` raises `X`; the cause is discarded (no `__cause__` / `__context__` chaining).
161
161
162
162
### Exception arguments
163
163
@@ -214,7 +214,7 @@ type
214
214
215
215
### Environmental errors
216
216
217
-
Failures surfaced before the source reaches the compiler, no line/column preview, no parsed code to anchor to. Emitted as plain text, uncatchable from Python.
217
+
Failures surfaced before the source reaches the compiler: no line/column preview, no parsed code to anchor to. Emitted as plain text, uncatchable from Python.
@@ -238,4 +238,4 @@ Exist for syntactic compatibility. For code reuse, use higher-order functions.
238
238
239
239
## Determinism
240
240
241
-
Same source + input -> same output across runs and architectures (`x86_64`, `aarch64`, `wasm32`). No time, randomness, threading, or OS interaction. Heap-pool slot reuse is the only nondeterminism, observable through `id(x)` only, never `==`, `repr`, or any other operation.
241
+
Same source + input -> same output across runs and architectures (`x86_64`, `aarch64`, `wasm32`). No time, randomness, threading, or OS interaction. Heap-pool slot reuse is the only nondeterminism: observable through `id(x)` only, never `==`, `repr`, or any other operation.
0 commit comments