Files
scriptc/tests/corpus/1637-inspect-dyn.ts
Chris Tate 6b6445ab90 Retire the "DOM" nickname in comments, internal docs, and message prose: the checked-dynamic tree / dyn values
- The ratified rename rider (world-unification §7 lane 5): "DOM" collided with the browser DOM and, post-lane-1, the structure is no longer a document tree. Comments and doc prose now say "the checked-dynamic tree" for the noun and "dyn" adjectivally; runtime symbol names (scr_dyn_*), the error.domClone libCall, and the real web DOMException family are unchanged.
- The few user-facing strings carrying the nickname move with it (the structuredClone cyclic message, the dc subscriber/publish fences, two emitter ICE texts); diagnostics snapshots regenerated (96 pass). One private compiler constant (DOM_PROTO_METHOD_NAMES -> DYN_PROTO_METHOD_NAMES) rides along.
- Mechanical sweep, 142 files, comments/prose only — no behavior change.
2026-07-24 11:14:58 -05:00

44 lines
1.9 KiB
TypeScript

// util.inspect over checked-dynamic values (unknown): the runtime walks
// the dyn itself — scalars, arrays (grid grouping included), objects
// with runtime-quoted keys, depth placeholders — and format's %s passes
// dyn strings verbatim. Keys stay in insertion order with no
// integer-like keys after string keys (the checked-dynamic tree's documented Object.keys
// stance). Node is the oracle byte-for-byte.
import { format, inspect } from "node:util";
const scalars: unknown = JSON.parse('[1,-0.5,"two",true,false,null]');
console.log(inspect(scalars));
console.log(inspect(JSON.parse("1e21")));
console.log(inspect(JSON.parse('"it\'s"')));
console.log(inspect(JSON.parse("true")));
console.log(inspect(JSON.parse("null")));
const tree: unknown = JSON.parse('{"a":[1,2],"s":"x","n":null,"deep":{"x":{"y":{"z":1}}}}');
console.log(inspect(tree));
const grid: unknown = JSON.parse(`[${Array.from({ length: 30 }, (_, i) => i).join(",")}]`);
console.log(inspect(grid));
const strings: unknown = JSON.parse('["alpha","beta","gamma","delta","epsilon","zeta","eta","theta"]');
console.log(inspect(strings));
const quotedKeys: unknown = JSON.parse('{"a-b":1,"ok_1":2,"k l":3,"__proto__x":4}');
console.log(inspect(quotedKeys));
const mixed: unknown = JSON.parse('[{"name":"first","values":[1,2,3]},{"name":"second","values":[4,5,6]}]');
console.log(inspect(mixed));
// depth options apply to the runtime walk too
const deep: unknown = JSON.parse('{"l1":{"l2":{"l3":{"l4":1}}}}');
console.log(inspect(deep));
console.log(inspect(deep, { depth: 0 }));
console.log(inspect(deep, { depth: null }));
// format: dyn strings pass VERBATIM through %s (no quotes); composites inspect
const dynStr: unknown = JSON.parse('"raw text"');
console.log(format("%s!", dynStr));
const dynArr: unknown = JSON.parse("[1,2]");
console.log(format("%s!", dynArr));
console.log(format("rest:", dynStr, dynArr));