Skip to main content

Module host_object

Module host_object 

Source
Expand description

Canonical registry for host-object identities.

Several JavaScript host builtins and boxed primitive wrappers — ArrayBuffer, DataView, WeakMap, WeakSet, SharedArrayBuffer, File, Blob, DOMException, and the boxed Number/Boolean/String/Symbol wrappers — have no useful structural shape that source code reads. They are constructed and then only tested with value instanceof X (the isWeakMap/isArrayBuffer family and the deep-clone dispatch). Their identity is known statically at the construction site.

Rather than let each host type invent its own __smelt_<marker> string in the frontend construction path, the instanceof codegen path, and the runtime for-in / structural-equality helpers independently, this module is the single source of truth for that identity. All three consumers read from HOST_OBJECTS so the construct side, the instanceof side, and the runtime host-marker registry can never drift apart (a drift that previously left the boxed-Boolean marker out of the runtime for-in filter).

This is deliberately not a general dynamic boundary: each entry is a concrete host identity with a known constructor. Genuine unknown/interop values still flow through the tagged dynamic ABI; this registry only names the host objects whose identity Smelt can resolve ahead of time.

Structs§

HostObject
A single host-object identity: the JavaScript constructor name, the dedicated identity marker key stamped onto the constructed record, and whether the identity denotes a boxed primitive wrapper.

Constants§

HOST_OBJECTS
The canonical set of host objects whose identity Smelt models with a dedicated marker record.

Functions§

host_object_by_class
Look up the host-object identity for a JavaScript constructor name.
host_object_marker
Return the identity marker key for a modeled host constructor, or None.
host_object_markers
Every host-object identity marker key, for the runtime host-marker registry.