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

introduce a magical KindMimic type #10144

Closed
wants to merge 1 commit into from
Closed

introduce a magical KindMimic type #10144

wants to merge 1 commit into from

Conversation

thestinger
Copy link
Contributor

Closes #9509

@thestinger
Copy link
Contributor Author

cc @nikomatsakis

@thestinger
Copy link
Contributor Author

This is a working solution to the problem for now. I've marked the struct with the #[unstable] stability marker so it can be revised later if more is needed. This should probably be split into separate type per-kind (SendMimic, FreezeMimic) because it's not going to make sense for Sized.

@nikomatsakis
Copy link
Contributor

This seems like a sensible approach. I had originally thought to couple the pointer and the kind translations -- that is, replace the *T that appears in Rc<T> with something like IndirectPtr<T>, that would be a *T but would be specially understood by the kind checker in a similar fashion to KindMimic. This seemed like it would fit in with Raw<T> as a possible future replacement for *T. But I think I prefer your solution, since it decouples the representation of the pointer from the type checker concerns. Overall I am not pleased that smart pointers require such a deep understanding of language concerns, but I guess this is somewhat inevitable.

I suspect we will need a few variations on KindMimic -- at least 2. If you see #10158 you can see that I broke down the translations for pointers into two categories, owned_pointer and other_pointer (used for managed, indirect). This is because some properties only matter if they are owned, and others matter if they are reachable. I guess KindMimic corresponds to other_pointer (or should).

Also -- can we not use the name kind? I've been trying to move us to the term "builtin bounds" because the term "kind" has a pre-existing usage (higher-kinded types).

@nikomatsakis
Copy link
Contributor

Thinking more about this-- maybe the right answer is just to make *T transmite the "reachable" constraints for T

@thestinger thestinger closed this Oct 29, 2013
@thestinger thestinger deleted the kind_mimic branch November 9, 2013 05:42
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.

no way to bubble up Send/Freeze through raw pointers
2 participants