This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
File-scoped namespace statements #98
Labels
UnderReview
Suggestion for which a full proposal is being worked out
Suggestion
Allow namespace statements to end with a semicolon instead of a block, indicating that the namespace declaration applies to the entire file.
Considerations
Most Q# source files declare exactly one namespace, such that the extra level of indenting is unnecessary in most common cases. Allowing
namespace
declarations to be file-scoped would cut down on the amount of boilerplate and nesting, making Q# source files easier to read (esp. for newer users).A similar discussion has led to the proposal and likely adoption of a similar feature into C# 10 (https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/file-scoped-namespaces.md).
Context
This proposal would not change any Q# semantics, but would provide a useful shorthand for existing features and semantics.
Examples
Example 1:
Using file-scoped namespaces to apply a namespace to all declarations in a file.
Example 2:
Mixing file- and block-scoped namespaces is forbidden.
Affidavit (please fill out)
Please add ticks by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: