we (web engine): Experimental web browser project to understand the limits of Claude

JS Object model: prototype chain, typeof, instanceof #95

open opened by pierrelf.com

Implement the JavaScript object model with prototype-based inheritance.

Scope#

Build the core object system that underpins all JavaScript values: property storage, prototype chain lookup, and type-related operators.

Object Representation#

  • Property map: string keys → property descriptors
  • Data properties: value, writable, enumerable, configurable
  • Accessor properties: get/set functions, enumerable, configurable
  • Internal slots: [[Prototype]], [[Extensible]]
  • Computed property keys (string and symbol)

Prototype Chain#

  • [[Get]]: walk prototype chain for property lookup
  • [[Set]]: set own property (respecting writable, setter)
  • [[HasProperty]]: check own + prototype chain
  • [[Delete]]: delete own property (respecting configurable)
  • Object.create() semantics: create object with given prototype
  • Object.getPrototypeOf / Object.setPrototypeOf

Operators#

  • typeof — return type string ("undefined", "object", "boolean", "number", "string", "function", "symbol")
  • instanceof — walk prototype chain checking against constructor.prototype
  • in operator — [[HasProperty]] check
  • delete operator — [[Delete]] on property

Property Enumeration#

  • for...in enumeration (own + inherited enumerable string properties)
  • Own property enumeration order (integer indices first, then insertion order)

Acceptance Criteria#

  • Object type with property map and prototype pointer
  • Property descriptors (data and accessor)
  • Prototype chain lookup for property access
  • typeof returns correct strings for all types
  • instanceof walks prototype chain correctly
  • in operator works for own and inherited properties
  • delete operator respects configurable flag
  • Property enumeration in correct order
  • Object.create with null prototype works
  • Unit tests for prototype chain, property descriptors, operators

Phase 10 — JavaScript Engine (issue 6 of 15). Depends on: JS Garbage Collector.

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mhn3lv4bx72x