Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was 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

@Strilanc

Description

@Strilanc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions