Skip to content

'Default arguments' -> 'Default parameters' #4833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nikitabobko
Copy link
Member

@nikitabobko nikitabobko commented May 8, 2025

Two fixes:

  1. Parameters refer to the variables on the declaration site. Arguments are the expressions that "fill in" the parameters. That's why it's called "default parameters" not "default arguments". You can even see that further in the paragraph it's already referred as a "default parameter"
  2. Lambda is not a parameter. It's an expression, and it's an argument that corresponds to a parameter with functional type.

I didn't touch anything in docs/topics/whatsnew/* because I don't consider them a part of the documentation but rather a piece of history that is written the way it's written.

Similarly, I didn't touch the following files:

  • ./docs/topics/gsoc-2023.md
  • ./docs/topics/k2-compiler-migration-guide.md

because they don't feel like a documentation to me. But let me know if you actually want me to update them

Further, I acknowledge that I'm changing the title of the section in ./docs/topics/functions.md file which will break the existing URL links. I don't know what are the policy for doing that (if there are any). So please let me know if I just can't change it, or if there is a more "migration friendly" way to do that.

Feel free to amend the commits as you please or let me know if there are changes that you want me to make, thanks

@nikitabobko nikitabobko requested a review from a team as a code owner May 8, 2025 09:41
@nikitabobko
Copy link
Member Author

BTW, the spec also calls it "default parameters" https://kotlinlang.org/spec/declarations.html#named-positional-and-default-parameters

@nikitabobko
Copy link
Member Author

Hmm, sorry, I maybe rushed a bit https://jetbrains.team/im/review/1AlVqg2AG16Y?message=C28bz0VH91z&channel=ei0qL1MCT31

I will make sure that we internally agree on the terminology and write back

@nikitabobko nikitabobko force-pushed the bobko/default-parameters branch from 878687f to f8d605c Compare May 8, 2025 16:12
@nikitabobko
Copy link
Member Author

That's the middle ground that we kinda agreed on:

  • It's definitely ok to call it "optional parameters", but unfortunately it's not a wide-spread term
  • It's ok to say it in full "parameters with default values"
  • It's ok to say "default value" (if it's clear from the context)
  • "default parameters" and "default arguments" are slightly problematic and it's better to avoid them

https://jetbrains.slack.com/archives/C06E082M6/p1746713347805569

…s not a parameter but an argument

Summarization of the team discussion:
- It's definitely ok to call it "optional parameters", but unfortunately
  it's not a wide-spread term
- It's ok to say it in full "parameters with default values"
- It's ok to say "default value" (if it's clear from the context)
- "default parameters" and "default arguments" are slightly problematic
  and it's better to avoid them

Discussion link:
https://jetbrains.slack.com/archives/C06E082M6/p1746713347805569

The commit fixes two problems:
1. Avoid using "default arguments" and "default parameters"
2. Lambda is not a parameter. It's an expression, and it's an argument
   that corresponds to a parameter with functional type.
@nikitabobko nikitabobko force-pushed the bobko/default-parameters branch from f8d605c to 61ed71f Compare May 8, 2025 16:20
@AlejandraPedroza AlejandraPedroza self-assigned this May 9, 2025
@AlejandraPedroza
Copy link
Contributor

Thanks for the detailed clarification! We'll work on it in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants