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

Implement static typing hints for signal declarations #26045

Closed
11clock opened this issue Feb 19, 2019 · 8 comments
Closed

Implement static typing hints for signal declarations #26045

11clock opened this issue Feb 19, 2019 · 8 comments

Comments

@11clock
Copy link

11clock commented Feb 19, 2019

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.

image

@vnen
Copy link
Member

vnen commented Feb 19, 2019

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.

@Chaosus Chaosus added enhancement and removed bug labels Feb 20, 2019
@MustaphaRashiduddin
Copy link

are you gonna target it for 3.2?

@vnen
Copy link
Member

vnen commented May 14, 2019

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.

@Shadowblitz16

This comment has been minimized.

@ACB-prgm
Copy link

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 Expected ',' or ')' error.

@Byteron
Copy link
Contributor

Byteron commented Mar 31, 2021

@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)

@Calinou Calinou changed the title Typing For Signals Implement static typing hints for signal declarations Mar 31, 2021
@vnen
Copy link
Member

vnen commented Apr 6, 2021

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.

@Calinou
Copy link
Member

Calinou commented Apr 6, 2021

Clsosing in favor of godotengine/godot-proposals#2557, as feature proposals are now tracked in the Godot proposals repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants