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

Readonly properties #106

Open
wants to merge 2 commits into
base: fork
Choose a base branch
from
Open

Readonly properties #106

wants to merge 2 commits into from

Conversation

dktapps
Copy link
Member

@dktapps dktapps commented Mar 18, 2023

Before this, readonly was silently ignored, so properties would be
treated the same as normal properties.

This change enforces write-once and no-unset policies for readonly
properties.

It also permits lockless reads of locally cached property values of readonly properties, since these can't be changed by another thread after initialization. This offers a performance benefit for objects whose properties are frequently accessed by multiple threads by reducing lock contention.

Currently this only covers stuff that is kept in the local cache, such
as thread-safe objects, closures, sockets and strings. The cache could
be extended to more stuff to permit this optimisation to apply to other
types of properties, but that's a task for another time.

Before this, readonly was silently ignored, so properties would be
treated the same as normal properties.

This change enforces write-once and no-unset policies for readonly
properties. It also permits lockless reads of locally cached property
values of readonly properties.

Currently this only covers stuff that is kept in the local cache, such
as thread-safe objects, closures, sockets and strings. The cache could
be extended to more stuff to permit this optimisation to apply to other
types of properties, but that's a task for another time.
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.

1 participant