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

Qubits in the condition of an if expression #489

Closed
bamarsha opened this issue Jul 20, 2023 · 1 comment
Closed

Qubits in the condition of an if expression #489

bamarsha opened this issue Jul 20, 2023 · 1 comment
Labels
enhancement New feature or request language

Comments

@bamarsha
Copy link
Contributor

From microsoft/qsharp-language#130:

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.

@bamarsha bamarsha added enhancement New feature or request language labels Jul 20, 2023
@bamarsha bamarsha changed the title Support qubits in the condition of an if expression Qubits in the condition of an if expression Jul 20, 2023
@sezna
Copy link
Contributor

sezna commented Mar 4, 2024

There's no plan to address this currently. We will revisit this in the future if we get more feedback along these lines.

@sezna sezna closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
@sezna sezna removed the needs triage label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request language
Projects
None yet
Development

No branches or pull requests

3 participants