mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-19 05:29:46 +08:00
- 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.
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
// @dynamic
|
|
// Object.create under --dynamic routes through the ENGINE's own
|
|
// Object.create — the checker types the result 'any' (an engine value),
|
|
// and the engine answers with REAL prototype semantics: reads delegate
|
|
// LIVE to the prototype, assignments shadow without touching it,
|
|
// prototype mutations AFTER creation show through the created object,
|
|
// and JSON.stringify serializes own keys only. null and engine-held
|
|
// prototypes route (checked-dynamic tree prototypes keep a named fence —
|
|
// their boundary marshal is a deep copy, which live delegation would
|
|
// contradict). Node is the oracle byte-for-byte.
|
|
"use strict";
|
|
|
|
// The null-prototype dictionary, engine-side.
|
|
const o = Object.create(null);
|
|
console.log(typeof o);
|
|
o.x = 1;
|
|
console.log(JSON.stringify(o), `${o.x}`);
|
|
|
|
// An engine-held prototype: the island rest binding is the engine's own
|
|
// arguments array, so its element is an engine object.
|
|
const grab = (...args) => args[0];
|
|
const proto = grab({ tag: 7 });
|
|
const child = Object.create(proto);
|
|
|
|
// Reads delegate live; own keys stay empty until assigned.
|
|
console.log(typeof child, `${child.tag}`);
|
|
console.log(JSON.stringify(child));
|
|
|
|
// Assignment SHADOWS: the prototype keeps its value.
|
|
child.tag = 99;
|
|
console.log(`${child.tag}`, `${proto.tag}`);
|
|
|
|
// Mutation-through-proto: a key added to the prototype AFTER creation is
|
|
// visible through the child — the delegation is live, never a copy.
|
|
proto.added = "late";
|
|
console.log(`${child.added}`);
|
|
console.log(JSON.stringify(child));
|
|
|
|
console.log("done");
|