-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
GDScript: Prevent circular dependencies #1737
Comments
See related closed issues: https://github.com/godotengine/godot-proposals/issues?q=is%3Aissue+is%3Aclosed+cyclic This is currently treated as a bug: godotengine/godot#21461. But in my opinion, I'd just reopen #460 to avoid duplicate reports. 😛 |
This is all not quite the same as preventing circular dependencies in the first place, thanks a lot for your intent. 😊 |
@ShalokShalom sorry, I see you edited the original post to suggest adding an option for this, I suggest to elaborate on your proposal more. 😮 This is confusing given circular references has not even been resolved yet. I'm not sure whether a simple language like GDScript will allow making it optional. |
Once circular references are possible, a circular dependency is possible too. This suggestion prevents it. |
You should really add some examples here. In which way are circular dependencies allowed? The only way I see this happening is with Unless you mean every cyclic reference is also a cyclic dependency. But if we remove that it's pretty much impossible to use static typing. Also not sure what "file order" means here since GDScript files are compiled individually. |
Just out of curiousity, what exactly makes it so difficult to implement static typing while allowing cyclic references? I'd imagine, that you could just check if a class has already been loaded and if so, use it for auto completion. |
Support for cyclic references is being added in godotengine/godot#65752 (only for 4.0 – it won't be backported to 3.x as it uses an entirely different GDScript implementation). |
Describe the project you are working on:
Independent from project, round-based strategy game.
Describe the problem or limitation you are having in your project:
Circular dependencies can still happen.
Describe the feature/enhancement and how it helps to overcome the problem or limitation:
The core idea is to prevent circular dependencies by requiring the file order and code order to be strictly in sync with the dependency order.
This can also be done optionally, in case it is seen as too intrusive as a default setting. 🙂
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
FSharp does this already. See here why and how
If this enhancement will not be used often, can it be worked around with a few lines of script?:
No.
Is there a reason why this should be core and not an add-on in the asset library?:
Since GDScript is in core and it's a clear improvement to it.
Much fun 🥳
The text was updated successfully, but these errors were encountered: