quil-rs
quil-rs copied to clipboard
Does `Program::declarations` need to change?
While merging quil-py into quil-rs, I came upon an old TODO without an issue, which I've moved into quil-rs as so:
// TODO: (9b9690d4 Marquess Valdez 2023-06-01 14:10:25 -0700)
// Should this filtering move to Program? Should we assume memory_regions will always make up all
// declarations and simplify this?
I'm not totally sure what this comment is getting at, but I wanted to connect the comment to an issue for discussion and tracking purposes.
If the comment is simply outdated, we should remove it and close this issue.
Yeah, it looks like Marquess was right here! This function is needlessly reconstructing the full set of Quil instructions before pulling out the DECLAREs – but we've already done that! It should work like fn gate_definitions, where it starts self.as_inner().memory_regions.map(…) instead.