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

Enforce type metadata immutability #5

Open
rjmholt opened this issue Jun 6, 2018 · 0 comments
Open

Enforce type metadata immutability #5

rjmholt opened this issue Jun 6, 2018 · 0 comments

Comments

@rjmholt
Copy link
Owner

rjmholt commented Jun 6, 2018

Metadata types should be immutable since they describe something that has been read and cannot be changed. There are some challenges to this such as:

  • Nested types may want a reference to their parent, but if the nested type constructs first it can't reference the parent, and if the parent constructs first, it can't contain the children
  • Methods/properties/fields can all have the type they belong to as types or parameter signatures, or worse, nested types

Some solutions here are:

  • Use a prototype pattern to build the structure, with prototypes caching their own instantiation. Then crystallise the whole metadata hierarchy in a second pass
  • Use lazy instantiation. This has the benefit of possibly being more performant for workloads that are only interested in a subset of metadata, but would have overhead in general
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

No branches or pull requests

1 participant