Skip to content
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

Fix differences between String and StringName's documentation #95758

Merged

Conversation

Mickeon
Copy link
Contributor

@Mickeon Mickeon commented Aug 18, 2024

The PR's title is pretty self explanatory. There have been changes done to String, but not applied to StringName. This PR fixes that, and tweaks a few other miscellaneous things on the way.
This is not the only class that suffers from subtle differences. Even one small difference adds a whole new string to translate. In my experience this was seriously irritating to see. Not to mention, the inconsistent information given between two similar classes does add up over time.

To all maintainers, please, pay attention to these kinds of classes before approving and merging.
I am aware it is a burden to maintain, but there's currently no system for shared documentation snippets for classes to share, only ideas.

@Mickeon Mickeon added bug documentation cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Aug 18, 2024
@Mickeon Mickeon added this to the 4.4 milestone Aug 18, 2024
@Mickeon Mickeon requested a review from a team as a code owner August 18, 2024 16:02
@@ -263,12 +263,12 @@
print("User {id} is {name}.".format([["id", 42], ["name", "Godot"]]))
[/codeblock]
See also the [url=$DOCS_URL/tutorials/scripting/gdscript/gdscript_format_string.html]GDScript format string[/url] tutorial.
[b]Note:[/b] The replacement of placeholders is not done all at once, instead each placeholder is replaced in the order they are passed, this means that if one of the replacement strings contains a key it will also be replaced. This can be very powerful, but can also cause unexpected results if you are not careful. If you do not need to perform replacement in the replacement strings, make sure your replacements do not contain placeholders to ensure reliable results.
[b]Note:[/b] Each replacement is done sequentially for each element of [param values], [b]not[/b] all at once. This means that if any element is inserted and it contains another placeholder, it may be changed by the next replacement. While this can be very useful, it often causes unexpected results. If not necessary, make sure [param values]'s elements do not contain placeholders.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intent was to make this much clearer without rearranging everything, but I am still not particularly fond of this at all. Makes it looks more complex than it really is.

@Mickeon

This comment was marked as resolved.

@Mickeon Mickeon force-pushed the documentation-no-differences-String branch from d55372b to 519351f Compare August 18, 2024 16:26
@Mickeon Mickeon requested a review from AThousandShips August 18, 2024 16:40
@Mickeon Mickeon removed cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Aug 19, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@Repiteo Repiteo merged commit 6d08005 into godotengine:master Nov 12, 2024
18 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 12, 2024

Thanks!

@Mickeon Mickeon deleted the documentation-no-differences-String branch November 12, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants