dotnet / csharplang

The official repo for the design of the C# programming language
11.49k stars 1.02k forks source link

[Proposal]: Implementation specific documentation #7898

Open BillWagner opened 8 months ago

BillWagner commented 8 months ago

Implementation specific documentation

Summary

In LDM, we've wanted to be precise and complete on the behavior of new features. This means that feature speclets often include more implementation details than we might want in the official language specification. We want a roadmap for ourselves to document this behavior, and guidelines on what should be in the language specification vs. roslyn-specific documents.

For example, the roslyn repo already includes a document for Specification deviations.

Motivation

We want to clearly define all supported behavior, but we also want to keep the language specification "clean" regarding many implementation details.

Detailed design

There should be four different documents in the roslyn repo, and the published on Microsoft Learn in the language specification area. Most are required in the section of the specification on Portability issues

Drawbacks

It is more work.

Alternatives

We could require all the implementation behavior to be part of the language specification.

Unresolved questions

What behaviors that aren't required by the standard are supported by roslyn?

Design meetings

This issue was raised on Jan 31. Notes aren't yet available.

BillWagner commented 8 months ago

@CyrusNajmabadi Does this capture your thoughts on Wednesday?

BillWagner commented 8 months ago

Another area for discussion on this issue:

How do we want to handle spec deviations where the rolsyn compiler behavior enables code constructs that the Standard prohibits.

One example is how roslyn handles reference parameters for iterator methods and async methods

In both clauses, the standard states:

When a function member is implemented using an iterator block (or async method), it is a compile-time error for the formal parameter list of the function member to specify any in, out, or ref parameters, or any parameter of a ref struct type.

However, the roslyn implementation allows this as long as that parameter isn't captured by the iterator or async state machine.