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

Migrate the standard library to the project system #1912

Merged
merged 33 commits into from
Sep 17, 2024

Conversation

sezna
Copy link
Contributor

@sezna sezna commented Sep 10, 2024

This PR migrates the standard library into a Q# project structure.

Previously, we provided the modern standard library API via re-export, while the "true" stdlib was defined in the old explicit-namespace style. Now, that is inverted: the stdlib's code is housed in a project with implicit namespaces, and the legacy (Microsoft.Quantum.____) API is provided via re-exports.

Why do this? Well, for one, the standard library should look like a regular library and use the latest features we have.
Secondarily, auto-imports and other language dev tools now refer to these items by their Std.__ name, not their Microsoft.Quantum.__ name. See the video below for an example of this in completions:

Screen.Recording.2024-09-10.at.2.10.06.PM.mov

Go-to def rendering the new paths:

Screen.Recording.2024-09-11.at.4.54.15.PM.mov

Note that Unstable.* has not been migrated to the modern API, as we want to explore stabilizing state preparation (#1910)

Core is also not included, but for different reasons: #1911. Coming in a Follow Up PR™️ (alex/1911 if you want to preview the work there)

Copy link

Change in memory usage detected by benchmark.

Memory Report for ace3256

Test This Branch On Main Difference
compile core + standard lib 17862076 bytes 18002928 bytes -140852 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for 38c251c

Test This Branch On Main Difference
compile core + standard lib 17862268 bytes 18002928 bytes -140660 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for effc42f

Test This Branch On Main Difference
compile core + standard lib 17862268 bytes 18002928 bytes -140660 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for 670bae7

Test This Branch On Main Difference
compile core + standard lib 17862268 bytes 18002928 bytes -140660 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for 16216b3

Test This Branch On Main Difference
compile core + standard lib 17862268 bytes 18002928 bytes -140660 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for c42eb73

Test This Branch On Main Difference
compile core + standard lib 17862268 bytes 18002928 bytes -140660 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for bb2c5a7

Test This Branch On Main Difference
compile core + standard lib 17862268 bytes 18002928 bytes -140660 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for 07fb0f1

Test This Branch On Main Difference
compile core + standard lib 17868704 bytes 18009732 bytes -141028 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for fd3e09b

Test This Branch On Main Difference
compile core + standard lib 17868704 bytes 18009732 bytes -141028 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for 75f9e22

Test This Branch On Main Difference
compile core + standard lib 17882236 bytes 18023304 bytes -141068 bytes

Copy link

Change in memory usage detected by benchmark.

Memory Report for c8f7a5c

Test This Branch On Main Difference
compile core + standard lib 17882252 bytes 18023304 bytes -141052 bytes

@sezna sezna added this pull request to the merge queue Sep 17, 2024
Merged via the queue into main with commit 7f6e302 Sep 17, 2024
18 checks passed
@sezna sezna deleted the alex/all-stdlib-except-core branch September 17, 2024 20:21
github-merge-queue bot pushed a commit that referenced this pull request Sep 26, 2024
This is a follow-up to #1912, and includes an associated RCA bug fix
(#1918 ) that was not exposed until I tried to re-export something from
`Core`.

This also makes a subtle change to the compiler where the prelude is no
longer created by default in the namespace tree, and is rather created
when we compile `core.qs`. This was needed because we no longer allow
"clobbering namespaces", that is, re-opening a namespace from an
_external_ package.

---------

Co-authored-by: César Zaragoza Cortés <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants