-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Implement static typing hints for signal declarations #26045
Comments
This is not a bug, it was deliberately not implemented. Typing for signals require much more thought than regular typing for variables and methods. I thought there was an issue about this already, but couldn't find in a quick search. |
are you gonna target it for 3.2? |
Since this has come up again, let me clarify that the reason that I didn't add typing for signals is that it's difficult to enforce in the compiler. Since signals use strings and variables to connect and emit, it's harder to track the origin of the signal and connected function. Once we add first-class functions we'll be able to connect directly using a function reference, then it'll be easier to track and enforce the typing rules in signals. |
This comment has been minimized.
This comment has been minimized.
This makes sense not to change it given what @vnen has said, though it would be nice. I would ask that you update the error message that comes up when you try to type hint to save people from having to google to figure out why they are getting the |
@vnen now that GDScript 2.0 is all up and running, is there any chance we can get this? (or maybe it even is implemented? I haven't seen anything about it yet) |
BTW This should be moved to https://github.com/godotengine/godot-proposals On Godot 4.0 there's already too much stuff and I don't really have time to tinker about this one, so the answer is: no, this is won't available in Godot 4.0. It's still a similar issue: signals don't really have a type in core so those are never checked. Even with the stringless syntax, without the core enforcing this all the time it may break type expectations. Could be done as only a compile-time hint but I prefer to implement things properly. |
Clsosing in favor of godotengine/godot-proposals#2557, as feature proposals are now tracked in the Godot proposals repository. |
Godot version:
3.1 beta 4
OS/device including version:
Windows 10
Issue description:
You can't add typing to signals. This was probably a missed thing when implementing typing.
The text was updated successfully, but these errors were encountered: