Skip to content

v1.7.0

Compare
Choose a tag to compare
@billti billti released this 24 Jul 23:23
· 127 commits to main since this release
5763700

QDK 1.7.0 release notes

The team is very excited to ship this release. It has some of the most significant improvements to the Q# language in a long time.

Major language changes

External project references

The biggest feature in this release is the ability to reference other projects and consume their APIs. The projects can be in a separate local directory or published to GitHub. As part of this change, we also introduced import and export syntax, and generate an implicit namespace hierarchy based on file layout, removing the need for the namespace syntax.

For more details see the wiki page at https://github.com/microsoft/qsharp/wiki/Q%23-External-Dependencies-(Libraries). (The official documentation will be updated shortly with more details and examples).

New struct syntax

We're also introducing a new struct syntax, and long term see this as the replacement for the current UDT syntax. The custom types created by either are largely compatible, but the new syntax is simpler, cleaner, and similar to several popular languages. See more details at https://github.com/microsoft/qsharp/wiki/Q%23-Structs until the official docs are updated.

Optional EntryPoint

As well as removing the need to wrap code in a namespace, we're also removing the need to specify the EntryPoint attribute. If you have one callable called Main in your project, this will be the default entry point. (Note: Any specified @EntryPoint will still take precedence).

A new standard library namespace

We've also simplified the namespaces for our standard library. What was previously all under Microsoft.Quantum can now be accessed under the Std namespace. This reduces visual clutter and highlights what APIs are part of the "standard" library included with Q#.

Example

Taken together the above provides for a much cleaner language with a simple code sharing mechanism. For example, if your project references another project named Sparkle which exports an operation named Correct that takes a custom type Input with a Double and a Qubit, your entire Q# code to call this can be as simple as:

import Std.Diagnostics.DumpMachine;
import Sparkle.Input, Sparkle.Correct;

operation Main() : Unit {
    use q = Qubit[1];
    let x = new Input { A = 3.14, B = q[0] };
    
    Correct(x);

    DumpMachine();
    MResetZ(q[0]);
}

(Note these changes are additional capabilities. There are no breaking changes or requirements to change code to adopt this release).

Other updates and improvements

Many other changes have gone into this release. Some of the main ones include:

  • Unitary Hack contributions
    • Save RE widget to .png (#1604)
    • Lint rule: Use Functions (#1579)
    • Add doc for internal AND (#1580)
  • New DrawRandomBool API (#1645)
  • New DoubleAsStringWithPrecision API (#1664)
  • Fix display of CCX in a circuit (#1685)
  • Completion list improvements (#1682, #1715)
  • New samples (e.g. #1721)
  • Many more Katas additions and updates
  • Various bug fixes and perf improvements
  • Lots of engineering improvements to build times, testing, pipelines, etc.

New Contributors

Full Changelog: v1.6.0...v1.7.0

We hope you enjoy this release. Please log an issue if you need any assistance or to provide feedback. Thanks!