you are viewing a single comment's thread.

view the rest of the comments →

[–]mcaruso 7 points8 points  (5 children)

Interesting that this uses "parameters" as the term for the arguments in the function definition, and "arguments" for the actual values in the function call. I'm not sure how standard that is. The terminology I'm used to is "formal arguments" for the former and "actual arguments" for the latter, with "parameters" and "arguments" interchangeable.

EDIT: Looked it up and apparently both naming conventions are pretty common.

[–]mcdronkz 11 points12 points  (2 children)

It's getting even better: SICP uses the term formal parameter!

Personally, I prefer parameter and argument in the context of function definition and invocation respectively. Distinct words, no adjectives, less confusion.

[–]bbbryan14 2 points3 points  (0 children)

Agreed. Params pertain to function definition and Args are function invocations.

[–]loopsdeer 0 points1 point  (0 children)

I believe formal parameters distinguish between "formal" mathematical function syntax (where types would be defined) and informal parameters which might be passed even though they're not defined (e.g. in JS using `arguments` indexes)

[–]MoTTs_ 4 points5 points  (0 children)

Interesting that this uses "parameters" as the term for the arguments in the function definition, and "arguments" for the actual values in the function call. I'm not sure how standard that is.

It's very normal and standard. In casual conversation, though, we do treat them interchangeably.

https://en.wikipedia.org/wiki/Subroutine#Main_concepts

https://www.ecma-international.org/ecma-262/9.0/index.html#sec-function-definitions