Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Allow qubit in if expression, meaning "use this as a control for all operations in the block" #130

Open
Strilanc opened this issue Mar 16, 2022 · 0 comments

Comments

@Strilanc
Copy link

Add sugar to the language so that this:

if qubit {
    swap(a, b);
    other_thing(b, c);
}

becomes this:

Controlled swap([qubit], (a, b));
Controlled other_thing([qubit], (b, c));

If the sugar produces bad results (e.g. attempting to control an operation that has no controlled variant), that's a compile error.

Note that if b { f(c, d); } is fewer characters than Controlled f([b], (c, d)), is easier to type, and IMO is easier to read.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant