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

Merged
merged 7 commits into from
Jul 4, 2025

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

@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.

@AlejandraPedroza
Copy link
Contributor

Hi again, @nikitabobko
I reviewed your PR, and so far it looks good. Thanks for updating the Kotlin docs! (:

  • Regarding modifications to docs/topics/whatsnew/* , ./docs/topics/gsoc-2023.md, ./docs/topics/k2-compiler-migration-guide.md, and any other document containing the mention of 'default arguments': could I ask you to update them as well? From the user's perspective, this is content living in the same portal and will be less confusing, more intuitive, and easier to understand if we stick to a consistent term across the content in kotlinlang.org.
  • Regarding the safest way to update a section heading (anchor): when redirecting anchors, you can make a "find and replace" in all the files in our repo. For instance, I did a quick search and found some mentions to #default-arguments in four files. Could you please update all the mentions with the new section name?

Please let me know if I can help.

Thanks.

@nikitabobko
Copy link
Member Author

Regarding the safest way to update a section heading (anchor): when redirecting anchors, you can make a "find and replace" in all the files in our repo

Yes, it's clear that I can update the links across the site, and I believe I already did that, but I will recheck. Anyway, my concern was about other sites that refer to kotlinlang.org

@nikitabobko nikitabobko force-pushed the bobko/default-parameters branch from 61ed71f to d6d7af7 Compare June 27, 2025 10:15
@nikitabobko
Copy link
Member Author

nikitabobko commented Jun 27, 2025

I had to force push because of merge conflicts. The first commit is untouched, it's just rebased

Regarding modifications to docs/topics/whatsnew/* , ./docs/topics/gsoc-2023.md, ./docs/topics/k2-compiler-migration-guide.md, and any other document containing the mention of 'default arguments': could I ask you to update them as well?

I've updated these docs as well. I've yet skipped ./docs/topics/k2-compiler-migration-guide.md because it's hard to come up with reasonable title for the issue, and the text in md document is literally a copy of YT issue title https://youtrack.jetbrains.com/issue/KTLC-97

Could you please update all the mentions with the new section name?

Done. I indeed missed a couple of other anchors

nikitabobko and others added 6 commits July 4, 2025 15:40
…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.
See the commit before the previous for motivation
@AlejandraPedroza AlejandraPedroza force-pushed the bobko/default-parameters branch from e97ea6a to e37c5cd Compare July 4, 2025 13:40
Copy link
Contributor

@AlejandraPedroza AlejandraPedroza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for working on these updates! 🚀 🚀

@AlejandraPedroza AlejandraPedroza merged commit 8a94fb0 into master Jul 4, 2025
4 checks passed
@AlejandraPedroza AlejandraPedroza deleted the bobko/default-parameters branch July 4, 2025 13:57
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