Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/active/stdlib_json_extraction_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ the public `json.*` API.
`new`/`add`/`remove`/`contains`/`length`/`is_empty`/`to_list`/`union`/
`intersection`/`difference`, so JSON set parsing fixtures typecheck through
normal builtin signatures.
- The compiler-backed public `map.*` surface is transitional technical debt.
The final boundary requires every public map declaration and signature to
come from compiler-shipped `.jett` source, with compositional operations
implemented by real Jett bodies and no compiler dispatch by public name.
[#61](https://github.com/vycdev/jett/issues/61) is the first bounded slice for
`is_empty`, `contains_key`, `set`, `get_or`, and `merge`. Follow-up extraction
must source-own the remaining public constructors, accessors, mutations,
conversions, iteration helpers, and higher-order operations. Storage, key
equality, lookup/update, and iteration may use private trusted runtime
kernels, but those kernels are implementation details rather than public
compiler-owned functions.

That means physical stdlib JSON fragments under `stdlib/json/` are available
to single-file builds, but ordinary `namespace json` functions still do not
Expand Down
21 changes: 20 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,26 @@ Format-specific modules such as `json` should live in `.jett` stdlib code once r

Functions like `list.filter`, `string.trim`, `math.sqrt`, `time.format`, `crypto.sha256`, etc. These are regular `.jett` files that use the same language features as user code. The compiler discovers them via the namespace system (they declare namespaces like `namespace string`, `namespace math`, etc.).

The compiler does not have hardcoded knowledge of these functions. They are resolved by name during name resolution like any other `use` import.
The compiler-backed public map namespace is transitional technical debt. Its
target boundary is an exported compiler-shipped `.jett` declaration for every
public `map.*` operation, with compositional helpers implemented by real Jett
bodies and no hardcoded compiler knowledge of public map names or signatures.
Storage, key equality, lookup/update, and iteration may delegate to private
trusted runtime kernels; those kernels are implementation details, not public
compiler-owned functions.

[#61](https://github.com/vycdev/jett/issues/61) is a bounded first slice that
moves `map.is_empty`, `map.contains_key`, `map.set`, `map.get_or`, and
`map.merge`. Follow-up work must add source-owned public declarations for
`new`, `length`, `has`, `get`, `insert`, `remove`, `keys`, `values`,
`from_lists`, `entries`, `filter`, `map_values`, and `for_each`, replacing each
remaining hardcoded public signature and runtime dispatch arm. Only private
storage, key-equality, lookup/update, and iteration kernels may remain behind
those source declarations.

At the target boundary, the compiler does not have hardcoded knowledge of
public stdlib function names or signatures. Source-defined public functions are
resolved through their declarations like ordinary namespaced code.

The current math extraction is intentionally narrower than that end state.
`math.is_even`, `math.is_odd`, `math.sign`, `math.to_radians`, and
Expand Down
14 changes: 14 additions & 0 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,20 @@ map[string, list[User]] by_role = list.group_by(users, function(u: User) returns

An LLM calling `list.filter` cannot produce an off-by-one error. It cannot forget to handle an empty list. It cannot accidentally mutate the original. The standard library handles all of this.

The current compiler-backed public map surface is transitional technical debt.
Every public `map.*` declaration must ultimately live in compiler-shipped
`.jett` source, with compositional helpers implemented as real Jett bodies and
no public names or signatures hardcoded in the compiler. Low-level storage,
key-equality, lookup/update, and iteration behavior may remain behind private
trusted runtime kernels, but those kernels are not public API.

[#61](https://github.com/vycdev/jett/issues/61) starts that transition with
`map.is_empty`, `map.contains_key`, `map.set`, `map.get_or`, and `map.merge`.
Follow-up work must provide source-owned wrappers or bodies for the remaining
public constructors, accessors, mutations, conversions, iteration helpers, and
higher-order operations, then remove their hardcoded public signatures and
dispatch paths.

**String operations — no manual parsing:**

```
Expand Down
4 changes: 2 additions & 2 deletions docs/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
| MIR (control flow graph) | `jett_mir` | — | Not started ([Tracked by #22](https://github.com/vycdev/jett/issues/22)) |
| LLVM native codegen | `jett_codegen_llvm` | — | Not started |
| Runtime library | `jett_runtime` | — | Not started |
| Core stdlib (.jett files) | `stdlib/` | — | Partial (bootstrap loader plus marker module and extracted `json` module; `math.is_even`, `math.is_odd`, `math.sign`, `math.to_radians`, and `math.to_degrees` are source-defined in `stdlib/math.jett`; `math.sum` source extraction is [tracked by #63](https://github.com/vycdev/jett/issues/63); many other modules and math operations remain Rust-backed) |
| Core stdlib (.jett files) | `stdlib/` | — | Partial (bootstrap loader plus marker module and extracted `json` module; `math.is_even`, `math.is_odd`, `math.sign`, `math.to_radians`, and `math.to_degrees` are source-defined in `stdlib/math.jett`; `math.sum` source extraction is [tracked by #63](https://github.com/vycdev/jett/issues/63); the first map extraction slice is [tracked by #61](https://github.com/vycdev/jett/issues/61), toward a fully source-owned public map namespace backed only by private runtime kernels; many other modules and math operations remain Rust-backed) |

### Phase E: Comptime and Verification — COMPLETE

Expand Down Expand Up @@ -157,7 +157,7 @@
| `string` | Partial (30+ builtins: length/char_count, contains, trim, upper, lower, replace, split, join, starts_with, ends_with, is_empty, slice, repeat, pad_left, pad_end, from_int64, from_float64, from_bool, slugify, truncate, between, reverse, after, before, chars, words, lines, index_of, count, to_upper_first, to_lower_first; count/index/search/extraction helpers avoid partial grapheme matches) |
| `list` | Partial (40+ builtins: new, length, append, get, first, last, is_empty, skip, take, reverse, sort, contains, index_of, remove, concat, flatten, unique, zip, chunk, sort_by_index, is_sorted, all_elements_in, enumerate, from_set, repeat, range, last_index_of, insert_at, remove_at, swap + higher-order: filter, map, find, sort_by, all, any, count, sum, group_by, reduce, flat_map) |
| `set` | Partial (12 builtins: new, add, remove, contains, length, is_empty, to_list, union, intersection, difference) |
| `map` | Partial (17+ builtins: new, length, has/contains_key, get, get_or, insert/set, remove, keys, values, is_empty, merge, from_lists, entries + higher-order filter, map_values, for_each) |
| `map` | Partial (17+ compiler-backed public operations: new, length, has/contains_key, get, get_or, insert/set, remove, keys, values, is_empty, merge, from_lists, entries + higher-order filter, map_values, for_each; this is transitional debt, with the first compositional source-extraction slice [tracked by #61](https://github.com/vycdev/jett/issues/61) and follow-up required until every public declaration is source-owned and only private storage/equality/lookup/update/iteration kernels remain runtime-backed) |
| `math` | Partial (`is_even`, `is_odd`, `sign`, `to_radians`, and `to_degrees` are source-defined in `stdlib/math.jett`; `mod` and `pi` remain primitive Rust kernels used by those helpers; other supported operations such as abs, sqrt, pow, floor, ceil, round, clamp, log, log2, log10, min, max, average, median, e, sin, cos, tan, and sum remain Rust-backed; `math.sum` source extraction is [tracked by #63](https://github.com/vycdev/jett/issues/63)) |
| `json` | Partial (json.serialize, json.serialize_public, json.parse_exact, json.parse_raw/JsonValue accessors, compiler-owned public policy for parse/serialization; interpreter `json.parse`, `json.parse_exact`, `json.serialize`, and `json.serialize_public` require trusted stdlib-loaded reflected `.jett` hooks under `namespace json`; typed `json.parse[T]` routes through the stdlib `JsonTree` parser/decoder, including the `json.parse[JsonValue]` compatibility branch, while `json.parse_exact[T]` rejects unknown object fields recursively; stdlib `JsonTree` has a view-native serializer, scalar/array/object parser, exported raw facade wrappers, traversal/scalar-cast helpers, reflected parse/serialize for machine state/payload envelopes, and reflected decoding via `TypeConstruction` for nested structs, enum-annotated bitfields, enums, machines, lists/maps/sets, optionals/results, bytes, sized integer/float primitives, null, secret wrappers, aliases/refinements, and missing optional-field defaults; raw `JsonValue` parsing/access now runs on native `JsonTree` values through trusted stdlib facades with a shared `jett_common` JSON-facade policy for runtime dispatch, trusted hook mapping, and implicit view ownership, typechecker raw facade signatures now come from the exported `json.JsonTree` stdlib surface, with bare `JsonValue` preserved by the stdlib-only root alias to bundled `json.JsonTree`, using checked reflection metadata for direct type reflection builtins, `TypeInfo`, `type.arg`, trusted `comptime type` bindings for args/field/variant/machine-state loops, `TypeField`, `type.field_value`, bitfield metadata, machine metadata, active machine state/field access, enum variant metadata, `type.variant_value`, `type.variant_field_value`, `type.construct_variant_start`, `type.construct_machine_start`, `type.construct_put`, `type.construct_finish`, the runtime `main()` interpreter, and the `json.serialize` secret-containing type gate, with fallback-path audit complete, canonical `TypeId` metadata lookup scaffolding expanded to owner fields/bitfields/machines/variants, and missing checked owner metadata now surfaced for fields/bitfields/machines/variants) |
| `random` | Partial (5 builtins: int64, float64, bool, choice, shuffle; capability and entropy contract [tracked by #67](https://github.com/vycdev/jett/issues/67)) |
Expand Down