Skip to content

feat(vm): Complete object model; inheritance, dunder protocol, properties and IC.#7

Merged
dylan-sutton-chavez merged 7 commits into
mainfrom
feat/object-subste
May 12, 2026
Merged

feat(vm): Complete object model; inheritance, dunder protocol, properties and IC.#7
dylan-sutton-chavez merged 7 commits into
mainfrom
feat/object-subste

Conversation

@dylan-sutton-chavez
Copy link
Copy Markdown
Owner

@dylan-sutton-chavez dylan-sutton-chavez commented May 11, 2026

  1. Adds the NotImplemented singleton, a non-throwing resolve_attr_silent, and the central try_call_dunder helper in a new vm/handlers/dunder.rs. Centralizes the protocol so every later phase is a two-line insertion instead of reimplementing it per operator.

  2. Adds a bases field to HeapObj::Class, walks the chain in resolve_attr, and threads the current class through CallFrame. Comes before dunders because dunder lookup itself needs to find methods on base classes.

  3. Wires every operator and protocol handler to the dunder dispatch — arithmetic with subclass-first reflected ops, comparisons, __bool__/__len__, indexing, __call__, iteration with StopIteration, __hash__ with the eq-hash invariant, repr/str/format, getattr fallback, and full context-manager semantics via a new WithCleanup opcode.

  4. Recognizes @property and @x.setter at class construction and routes attribute access through them. Earns its own phase because properties are attribute access that executes code — they don't fit the dunder protocol shape.

  5. Adds FastOp::InstanceDunder with class-identity guards so monomorphic dunder calls promote like primitive ops. Without this, hot loops like Series.__getitem__ pay full resolution cost every iteration.

  6. Updates the markdown documentation to reflect the new supported surface. Lands after the implementation phases so the published reference always matches the shipped behavior, never ahead of it.

  7. Adds JSON coverage of the protocol matrix to catch ordering rules (subclass-first dispatch, exit suppression, IC invalidation) that fail silently when implemented naively.


CI / CD / Build Demo / GitHub Pages since it only promotes the mainline branch to production.

@dylan-sutton-chavez dylan-sutton-chavez merged commit 292fc92 into main May 12, 2026
3 of 4 checks passed
@dylan-sutton-chavez dylan-sutton-chavez deleted the feat/object-subste branch May 12, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant