microsoft / qsharp-language

Official repository for design of the quantum programming language Q# and its core libraries
MIT License
235 stars 56 forks source link

`body auto` should infer body block if any other block is specified #143

Open Strilanc opened 6 years ago

Strilanc commented 6 years ago

I've noticed myself often implementing body blocks exactly as follows:

body (...) {
    Controlled this_operation(new Qubit[0], (arguments))
}

which significantly reduces code duplication in cases where the controlled version of an operation only needs to control a few sub-operations, and you want both the controlled and uncontrolled versions of the operation.

I think the language should allow me to replace this boilerplate with just body auto, assuming the controlled block has been specified.

cpalmer2020 commented 5 years ago

Thanks for this. We'll take a look.

bettinaheim commented 5 years ago

Thank you for the feedback!

Note that changes to the Q# language are subject to our language design process. At this point we are not ready for contributions implementing this feature yet. This issue will migrate to the appropriate repository in the near future and will be processed there.

alan-geller commented 2 years ago

I'm going to transfer this issue to the qsharp-language repo, since that's now the proper place for language suggestions.