-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: OpDefs and TypeDefs keep a reference to their extension (#1719)
This change was extracted from the work towards #1613. Now `OpDef`s and `TypeDef`s keep a `Weak` reference to their extension's `Arc`. This way we will be able to automatically set the extension requirements when adding operations, so we can get rid of `update_validate` and the explicit registries when building hugrs. To implement this, the building interface for `Extension`s is sightly modified. Once an `Arc` is built it cannot be modified without doing internal mutation. But we need the `Arc`'s weak reference to define the ops and types. Thankfully, we can use `Arc::new_cyclic` which provides us with a `Weak` ref at build time so we are able to define things as needed. This is wrapped in a new `Extension::new_arc` method, so the user doesn't need to think about that. BREAKING CHANGE: Renamed `OpDef::extension` and `TypeDef::extension` to `extension_id`. `extension` now returns weak references to the `Extension` defining them. BREAKING CHANGE: `Extension::with_reqs` moved to `set_reqs`, which takes `&mut self` instead of `self`. BREAKING CHANGE: `Extension::add_type` and `Extension::add_op` now take an extra parameter. See docs for example usage. BREAKING CHANGE: `ExtensionRegistry::register_updated` and `register_updated_ref` are no longer fallible.
- Loading branch information
Showing
30 changed files
with
837 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.