Skip to content

(4) class objects: new / instanceof / typeof on a class-object value #1789

Description

@proggeramlug

Part of #1785. Design: #1772. Depends on #1786.

(4) new / instanceof / typeof on a class-object value

Scope

Make the instance-side operations work when the class is a class-object value (POINTER) rather than INT32(class_id):

  • new (classObjectValue)(args) → read class_id from the class object, instantiate via the existing class_id machinery.
  • x instanceof classObjectValue → resolve the class_id from the value and walk the class chain.
  • typeof classObjectValue === "function" (classes are callable in JS).
  • extends: js_register_class_parent_dynamic already reads class_id from a POINTER — confirm it stays correct with the class-object representation.

Acceptance criteria

  • const C = make(x); const c = new C(); c instanceof C === true.
  • typeof make(x) === "function".
  • effect's class X extends make(...) instances (where used) behave correctly.
  • No regression to new/instanceof on top-level class declarations.

Blocks

(6).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions