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

Gc<RefCell<T>> can be more ergonomic #2

Closed
Others opened this issue Jan 30, 2020 · 0 comments
Closed

Gc<RefCell<T>> can be more ergonomic #2

Others opened this issue Jan 30, 2020 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed T-enhancement New feature or request

Comments

@Others
Copy link
Owner

Others commented Jan 30, 2020

If you have a Gc<RefCell<T>> you need to have two guards:

let gc_guard = gc.get();
let ref_guard = gc_guard.borrow_mut();

Instead we should have some sort of impl like:

impl<T: Scan> Gc<RefCell<T>> {
    fn borrow() -> GcRef {
        ...
    }

    fn borrow_mut() -> GcRefMut {
        ...
    }
}

Which would increase ergonomics! Unfortunately GcRef and GcRefMut would be self referential structs, so we'd probably need rental, and that's why I haven't done this yet.

@Others Others added good first issue Good for newcomers help wanted Extra attention is needed T-enhancement New feature or request labels Jan 30, 2020
@Others Others closed this as completed in 15855fb Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed T-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant