dotnet / csharpstandard

Working space for ECMA-TC49-TG2, the C# standard committee.
Creative Commons Attribution 4.0 International
706 stars 84 forks source link

Parameters #2: Alternate Terms for a Parameter Kind #1159

Open RexJaeschke opened 1 month ago

RexJaeschke commented 1 month ago

Recently, I had cause to review the spec in terms of function parameters, and argument passing. [This was regarding adding future support for ref readonly parameters.] I found a lot of places where the text could be considerably simplified, made consistent, or have duplication of normative text removed. This issue deals with one aspect, and is not intended to result in any semantic changes. Rather, it is intended to create a better base on which to add future feature specs. Hopefully, we can decide offline on each proposal without taking up TG2 meeting time.

Issue

Variables.md, 9.2.8 Input parameters, states

A parameter declared with an in modifier is an input parameter.

So, the term “input parameter” is defined (and matches the parent section name). However, while 61 occurrences of text about input parameters uses that term, 33 occurrences use “in parameter” instead, for no obvious reason and with no value added.

The same situation exists for “output/out parameter” (9.2.7 Output parameters) and “reference/ref parameter” (9.2.6 Reference parameters).

[There is no such duplication for “value parameter.” 9.2.5 Value parameters states: “A parameter declared without an in, out, or ref modifier is a value parameter, and “value parameter” is used throughout.]

Proposal

Discussion

The term “by-reference parameters” is defined in 15.6.2.3.1 General and only referenced in Clause 15. It’s simply used to organize related subclauses as a group, so let’s use it instead of an enumerated list of its members.

RexJaeschke commented 2 weeks ago

@jskeet If you can add a thumbs-up to Nigel's, I'll make the changes.

jskeet commented 2 weeks ago

Yes, this definitely seems sensible to me.

RexJaeschke commented 1 week ago

On the 2024-09-04 TG2 call we agreed with Rex's proposal. Rex will create a PR for this.