Optimization: const members should be cached for all children in prototype chain #163

Closed
opened 2025-12-30 01:21:40 +01:00 by adam · 0 comments
Owner

Originally created by @bioball on GitHub (May 29, 2024).

The result of a const member cannot be late-bound, so its values should be cached for all children in the prototype chain.

As an observable effect, this should only result in one trace. Today, this has two.

class MyClass {
  const prop = trace("hello")
  res: Int
}

a = new MyClass { res = 1 }
b = (a) { res = 2 }
Originally created by @bioball on GitHub (May 29, 2024). The result of a `const` member cannot be late-bound, so its values should be cached for all children in the prototype chain. As an observable effect, this should only result in one trace. Today, this has two. ```groovy class MyClass { const prop = trace("hello") res: Int } a = new MyClass { res = 1 } b = (a) { res = 2 } ```
adam closed this issue 2025-12-30 01:21:40 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#163