Skip to content

Commit

Permalink
Add note for the purpose of input parameters
Browse files Browse the repository at this point in the history
Fixes #845.

I'm not at all convinced of the tone or precision of this - it's
effectively a straw man for further discussion.
  • Loading branch information
jskeet committed Nov 29, 2023
1 parent 5cc72ce commit 591bd27
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions standard/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,8 @@ Input parameters are not allowed on functions declared as an iterator ([§15.14]
In a method that takes input parameters, it is possible for multiple names to represent the same storage location.
> *Note*: The primary purpose of input parameters is for efficiency. When the type of a method parameter is a large struct (in terms of memory requirements), it is useful to be able to avoid copying the whole value of the argument when calling the method. Input parameters allow methods to refer to existing values in memory, while providing protection against unwanted changes to those values. *end note*
#### 15.6.2.4 Reference parameters
A parameter declared with a `ref` modifier is a reference parameter. A reference parameter is a local reference variable ([§9.7](variables.md#97-reference-variables-and-returns)) that gets its initial referent from the corresponding argument supplied in the method invocation.
Expand Down

0 comments on commit 591bd27

Please sign in to comment.