You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Repeated evaluation of a non-capturing class declaration returns the same class object #11759
A class declaration with no captures that is evaluated more than once yields the same class object each time. Node creates a fresh class on every evaluation.
The same happens for a non-capturing class declared in a loop body at module top level. Classes that capture variables are already fresh per evaluation, which is why the fixture in #11758 uses capturing classes for these cases.
Fixing this changes how classes inside bundle wrapper functions are compiled: CJS and esbuild bundles declare classes in functions that usually run once. So before changing the default, it needs a real-code census (tsc, Zod, the corpus) of how many repeated class evaluations actually happen and what per-evaluation class creation costs.
Partial progress: #11780 landed (fresh class objects: extends the evaluated class, own their members, stringify to source). Merged unverified at the owner's request; the full gates and cost A/B are still to run. Leaving open.
Activity
hir: a static extends of a per-evaluation class reads the evaluated c…
runtime: a fresh class object owns its length, name and static methods
runtime: String(C) and C.toString() on a fresh class are the class so…
tests: fresh class objects extend, own their members and stringify li…
proggeramlug commentedon Oct 3, 2026
Partial progress: #11780 landed (fresh class objects: extends the evaluated class, own their members, stringify to source). Merged unverified at the owner's request; the full gates and cost A/B are still to run. Leaving open.
hir: a static extends of a per-evaluation class reads the evaluated c…
runtime: a fresh class object owns its length, name and static methods
runtime: String(C) and C.toString() on a fresh class are the class so…
tests: fresh class objects extend, own their members and stringify li…
class: a repeatable class's instances keep their template's field proofs
class: later evaluations of a repeatable class declaration are fresh …
class: a loop over a repeatable class tests its first evaluation once