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

Refactor Document and ResolvedDocument for interior mutability #607

Closed
wants to merge 3 commits into from

Conversation

cycraig
Copy link
Contributor

@cycraig cycraig commented Jan 20, 2022

Description of change

This refactors WasmDocument to use Rc<RefCell> internally to reduce clones and for interior mutability when accessed from WasmResolvedDocument.

The WasmDocument API should be unchanged in terms of usage; WasmResolvedDocument on the other hand has several breaking changes listed below.

TODO

Links to any relevant issues

See discussion #603.

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Describe the tests that you ran to verify your changes.
Make sure to provide instructions for the maintainer as well as any relevant configurations.

TODO TODO

Change checklist

TODO TODO

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@cycraig cycraig added Wasm Related to Wasm bindings. Becomes part of the Wasm changelog Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog labels Jan 20, 2022
Remove WasmResolvedDocument::into_document
@cycraig
Copy link
Contributor Author

cycraig commented Feb 6, 2022

There are concerns that peppering the code with Rc<RefCell> may worsen challenges around memory management with wasm-bindgen, since it's unclear if we benefit from garbage collection with --weak-refs and even then it's a bit hazy. Particularly for objects like WasmDocument which are not expected to live for the entire life of the program (unlike the Client for instance), this may not be the best idea for now...

@cycraig
Copy link
Contributor Author

cycraig commented Sep 13, 2022

ResolvedDocument is to be removed with the legacy bindings.

@cycraig cycraig closed this Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Wasm Related to Wasm bindings. Becomes part of the Wasm changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant