-
Notifications
You must be signed in to change notification settings - Fork 6
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
Some way to apply a rewrite to a region of a Hugr #246
Comments
|
Ah yes good point. So
Yes. One loses any protection against the rewrite changing anything outside the region, and thus indeed, any protection against the rewrite removing the region altogether, but.... |
We can still run the checks before unwrapping (I think we'd only require the removed set to be in the graph)? |
That works nicely for Replace, I think, yes. But there are other rewrite too, e.g. (Inline/Outline)(C/D)FG. We could write checks for each of those individually, and (hmmm) yes we probably will have to in order to determine in advance whether the rewrite will stay within a region or not. We may also be able to make all Rewrites (not just Replace) do all their operations through a HugrView / MutRegion, so at least we can have some protection against accidents when the rewrite is being applied even if not in advance. |
The simplest way might be:
&mut impl HugrMut
, rather than only on a&mut Hugr
impl HugrMut for FlatRegionView
. This would presumably have to do some sanity checking that the relevant/affected/passed-in Nodes were "in" the region. I'm not sure how straightforward these would be, this might be the killer...HugrMut::apply_rewrite
, as a Trait-default method I think (and moved fromimpl Hugr
, in fact)The text was updated successfully, but these errors were encountered: