bi-05 step 01 — A toy binding layer

Goal

Build the boundary, not the engine. The point is to feel the four costs of crossing, and to make wrapper identity a thing you implemented rather than read about.

Tasks

  1. A tiny IDL-like schema: interface name, attributes with types, methods with argument types, plus [ForcesLayout] and [CrossOrigin] markers.
  2. A generator emitting JS accessors from the schema.
  3. A "C++ side" (plain objects standing in) with a wrapper map enforcing identity.
  4. Type coercion per your schema, including throwing on invalid input.
  5. [ForcesLayout] getters call flush() — reuse the dirty-marking scheme from bi-04.
  6. Two worlds: two wrapper maps over the same backing objects.

Done when

  • obj.x === obj.x holds, and expandos survive a round trip
  • An expando set in world A is invisible in world B
  • A [ForcesLayout] read in a write loop shows the complexity change