Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LazyPropertyDescriptor generic and some prototypes more lazy #1868

Merged
merged 1 commit into from
May 22, 2024

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented May 22, 2024

Using LazyPropertyDescriptor for objects that have many properties that can be seldomly used. Generic interface makes usage simpler.

@lahma lahma merged commit 1093b81 into sebastienros:main May 22, 2024
3 checks passed
@lahma lahma deleted the lazy-descriptors branch May 22, 2024 17:38
@sebastienros
Copy link
Owner

Take this line

["copyWithin"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "copyWithin", prototype.CopyWithin, 2, PropertyFlag.Configurable), PropertyFlags),

What state and what behavior in the actual implementation could vary across engines and scripts that it would prevent it from being a static ClrFunction instance?

Rephrased, should there be something else that an Engine instance (which a script can mutate), which could change how this method behaves? If not then there could be a way to have these more stable and shared across engine instances.

@lahma
Copy link
Collaborator Author

lahma commented May 23, 2024

The problematic piece is the actual Engine instance (and the active Realm instance). Engine configuration can alter some behaviors and as engine is not thread-safe it cannot shared between process-wide instances. Alternative would be to change every Call method etc to to take the active engine as parameter.

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.

2 participants