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 misplaced bad example #10782

Merged
merged 3 commits into from
Mar 26, 2025
Merged

Fix misplaced bad example #10782

merged 3 commits into from
Mar 26, 2025

Conversation

Lexyth
Copy link
Contributor

@Lexyth Lexyth commented Mar 18, 2025

Moved the bad example for the inferred type for functions that return super types directly after its related statement.

Moved the bad example for the inferred type for functions that return super types directly after its related statement.
Copy link
Contributor

@skyace65 skyace65 left a comment

Choose a reason for hiding this comment

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

What about this example makes you think it's misplaced? The entire page has the good example shown first and the bad example shown second.

@dalexeev dalexeev added enhancement discussion topic:gdscript area:manual Issues and PRs related to the Manual/Tutorials section of the documentation labels Mar 20, 2025
@Lexyth
Copy link
Contributor Author

Lexyth commented Mar 23, 2025

What about this example makes you think it's misplaced? The entire page has the good example shown first and the bad example shown second.

Edit: (My bad, I forgot that I had placed it before the good example and thought you were referring to moving it in general. I place it before the good example because the statement was directly mentioning the behavior displayed in the bad example, but I see how it would be confusing to switch up the order, so I'll change it to come after the good example. The main point of the PR was just to place it closer to its context, which it would be either way.)

The as keyword represents an alternative to state the type explicitly other than type hints, but is placed before a bad example that ONLY uses a type hint.

It was like this:

Statement about explicitly stating type, useful for get_node().
Good example of using a type hint.
Statement about the as keyword.
Good example of using the as keyword.
Bad example if using a type hint.

The good and bad examples both regard explicit type stating, but the bad only features type hints, so is not related to the as keyword statement, which therefore can as well come afterwards, putting the related examples closer together while still staying within the section it belongs to (i.e.: explicit type stating).

I'd say, it's confusing to add an alternative in the middle of a list of examples. It's not done anywhere else in the page, either. Explanations – of what was good/bad –, sure, they're related to the example, but an alternative doesn't fit there, as it's related to the topic the examples are about, not the examples themselves.
Alternatives could fit directly inside an example, maybe, but that, also, is only a place for smaller syntax alternatives, not whole keywords (e.g.: an example using var x = 5 # or const x = 5 to express that both can be used regarding topic).

Lexyth added 2 commits March 23, 2025 11:08
Moved the bad example below the good example to stay consistent with previous instances.
Removed Good example title from the example for the "as" keyword, as it is a neutral example.
@skyace65 skyace65 merged commit 2ec67eb into godotengine:master Mar 26, 2025
1 of 2 checks passed
@skyace65
Copy link
Contributor

Thanks! And congrats on your first merged PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation discussion enhancement topic:gdscript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants