GDCLASS
synced by ending with "private:"
#1292
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation of
GDCLASS
exits the define with the scope set to "public". This doesn't match the behavior utilized in the godot repository, so people working in the source repository or making a module might be confused by a differing style. The most obvious scenario is someone expecting to have their functions/values afterGDCLASS
to be implicitly private, as has normally been the case, but with gdextension they will be public. This has the potential to go unnoticed for a long stretch of time, as there's no warning for if something should be private; so a user could realistically continue coding as if the values were private, but as soon as that repo is passed on to someone else that guarantee is goneThe only area this change risks regression in is classes that assume an implicitly public scope after
GDCLASS
. To me, this is entirely worth it, as it's to the end of consistent behavior for all parties moving forward. In addition, unlike the prior public example, there will be warnings/errors for attempting to access a private function/value, so an affected user could immediately recognize and address the regression in a matter of secondsThe same appendment was given to
GDEXTENSION_CLASS
, mirroring the trailing style of similar defines in the godot repository. This won't actually change anything currently generated, as an explicit "public:" is always defined right after (inferring that the generator was setup expecting a private environment), but it'll be convenient moving forward to have that parity. In addition, the same line buffer found inGDCLASS
was added, so if any future changes to this define take place, they won't risk shaking up the diff logs