Skip to content

cppia: move live instances of a replaced class onto its replacement #265

Open

Description

@dimensionscape

When a newer module defines a class with the same name as an older one, instances created before keep the old class and its code, so replacing code in a running process only affects objects created afterwards.

An opt-in step at load or release time could retarget live instances of each replaced class to the new class when their layouts are compatible, and report the classes it could not move and why. Things to work through:

  • what counts as compatible: the same fields with the same types, and possibly new fields added at the end with default values;
  • field offsets, which cppia assigns per class (AlignOffset);
  • jitted code and vtables that hold the old class's functions;
  • closures and bound methods of the old class's methods;
  • interfaces the class implements, and how the collector marks instances through their class.

Activity

  1. dimensionscape commented on Oct 22, 2026

    @dimensionscape
    MemberAuthor

    Moving this past 6.0.0. It needs a design before code: what counts as a compatible layout, what happens to jitted code and vtables that hold the old class's functions, and to closures and bound methods of its methods. As an opt-in step it would not change how modules load today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions