This repository was archived by the owner on Aug 8, 2026. It is now read-only.
Readonly properties - #106
Open
dktapps wants to merge 2 commits into
Open
Conversation
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.
dktapps
force-pushed
the
readonly-properties
branch
from
March 24, 2023 16:14
06ccc97 to
d643d0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.