In a function declaration, while the parameters do not have to be named, is it preferable to have them named? What are the advantages and disadvantages of this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The advantage of naming them is that you can refer to them in the documentation. (This includes your editor/IDE picking them up and presenting them to you as hints when you type a call to such a function.)
A disadvantage would be that names might change according to the function’s implementation, except for the fact that the names in a function declaration might differ from those in the function’s definition. (IOW: I see no disadvantage.)