Parameters #1: The use of “formal” in “formal parameter”
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
The use of “formal” in “formal parameter” is unnecessary, inconsistent with other uses of “parameter,” and potentially misleading (as it suggests that its presence is significant).
Proposal
Remove “formal” from all occurrences of “formal parameter” in narrative and grammar rule names.
Discussion
From Wikipedia:
In computer programming, a parameter or a formal argument is a special kind of variable used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are the values of the arguments (often called actual arguments or actual parameters) with which the subroutine is going to be called/invoked.
Draft V8 of the spec contains 38 occurrences of “formal parameter,” and many more occurrences of “parameter” without “formal,” but having no semantic difference.
[There were 41 occurrences in the original MS submission, and 41 in Ecma V1. I think that Pascal uses the terms “actual” and “formal” w.r.t parameters, and as Anders spent a lot of time implementing Pascal (Turbo-Pascal and Object Pascal), perhaps that is why “formal parameter” appears in the initial MS spec.]
In the “Terms and definitions” clause, we do define “argument” and “parameter.” We do not define “formal parameter.”
If one was to argue for keeping “formal” and using it consistently, one would need to add it to many other places, including those like “value [formal] parameter,” “input [formal] parameter,” “output [formal] parameter,” and “reference [formal] parameter,” which makes them unwieldy while adding no value.
Although we have a grammar rule, formal_parameter_list, there is no rule called parameter_list, so removing the formal_ prefix from this rule name (and all references to it) is safe to do.
@jskeet If you can add a thumbs-up to Nigel's, I'll make the changes.
Yup, that seems reasonable to me. We should get approval from other folks before merging any change though.
On the 2024-09-04 TG2 call we agreed with Rex's proposal. Rex will create a PR for this.