-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
Vary capabilities on generics #807
Comments
We discussed this on the sync call, and the consensus was that treating a type parameter in the same way as a type alias (as @jemc said "a localised type alias") makes sense. |
Note that after adopting George Steed's viewpoint adaptation model, the example above could be solved with a viewpoint-adapted type. For example, you could have the type parameter |
Yes, that code snippet is what I mean, and no, I'd not expect it to work right now because our viewpoint adaptation rules don't match #2815 (and there are now questions in that ticket as to whether we should continue with it). |
The following code compiles fine:
However, if we want to make this generic and just be a
Store
where we pass in any sort of data structure, not just a Map, then we hit a problem:The issue is, that we need to be able to say
DataStructure iso
in our constructor but can't as that is currently disallowed. If we put it on our type params, then our_state
variable is no longer a ref and the code can't work as intended. We don't want an iso, we want a ref.I talked this over with @sylvanc and he agrees its a very reasonable thing to want to do.
The text was updated successfully, but these errors were encountered: