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

Consider using a phantom type in JS<T> to indicate rooted-ness #14901

Closed
jdm opened this issue Jan 6, 2017 · 2 comments
Closed

Consider using a phantom type in JS<T> to indicate rooted-ness #14901

jdm opened this issue Jan 6, 2017 · 2 comments
Labels
A-content/bindings The DOM bindings I-safety Some piece of code violates memory safety guarantees.

Comments

@jdm
Copy link
Member

jdm commented Jan 6, 2017

It has been claimed that being able to write static analysis that verifies safe rooting behaviour is more complex when multiple types are involved (ie. JS<T>, Root<T>). A proposal for reducing this complexity is to add a phantom type to JS<T>, so we get JS<T, Unrooted> or JS<T, Rooted>. More specific examples of why this is easier to analyze would be valuable.

@jdm jdm added A-content/bindings The DOM bindings I-safety Some piece of code violates memory safety guarantees. labels Jan 6, 2017
@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 24, 2017

If we did this, we'd probably want to keep typedefs like type Root<T> = NewThing<T, Rooted>.

@nox
Copy link
Contributor

nox commented Oct 7, 2017

I don't think this would reduce complexity but instead increase it. Nowadays Root<T> just contains a T, so it's not like it would even help.

@nox nox closed this as completed Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/bindings The DOM bindings I-safety Some piece of code violates memory safety guarantees.
Projects
None yet
Development

No branches or pull requests

3 participants