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

Design+implementation for handling boolean properties #7

Open
davidmorgan opened this issue Jun 19, 2024 · 2 comments
Open

Design+implementation for handling boolean properties #7

davidmorgan opened this issue Jun 19, 2024 · 2 comments
Assignees
Labels
type-enhancement A request for a change that isn't a bug

Comments

@davidmorgan
Copy link
Contributor

Copied from a review reply on #3

On the one hand we want to preserve uniformity, so for example it should be possible to say "is static" and have that mean something in any place in the model where it makes sense.

On the other hand it is good to have the API statically encode knowledge about what properties are available.

So probably we end up with a family of Properties types, compatible on the wire but adding knowledge about validity via the extension types.

@jakemac53
Copy link
Contributor

This is also about how to represent what "kind" an object is. A class, function, getter, etc.

@davidmorgan
Copy link
Contributor Author

Right.

My current idea is to think of properties as "capabilities", i.e. that they tell you about something you can do with the entity.

In some cases that "something you can do" is that you can interpret the entity using a particular extension type; or, equivalently, that it complies with a particular fragment of JSON schema.

In that case they would come with "is/as" methods, so for example

for (final function in members.map((m) => m.asFunction).nonNulls) {
  ...do something for all functions... 
}

I guess what we end up with is, in OO terms: the "kind" is the concrete type, and the properties describe the interfaces that it implements.

From a schema point of view we would have a oneOf, and a property that selects between them. So for example Member has {"kind": "member"} in its schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
Development

No branches or pull requests

2 participants