-
Notifications
You must be signed in to change notification settings - Fork 95
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
InputSender does not have a class name #572
Comments
|
@bitwes what's actually the reason for using the |
Curious about this too. We are starting with Godot 4, and decide to turn on 'warn as error' to require type hints wherever possible. We just want the added level of safety to catch bugs sooner. But then working with libraries that don't use any type hints becomes extremely difficult. |
One reason is that Another is that Godot doesn't have any way to do name-spacing for I've started using Finally, I've gotten pretty used to not using strict typing or |
Thanks for that context. I think you should be able to code how you see fit in your project. I wonder if Godot contributors would consider adding a scope hint of some kind. So that you can have class names that are only resolvable from within your directory, or something to that effect, and allow you to explicitly export your intended public API. Javascript has a similar problem where packages might conflict, but it's very rare so no one really worries about it, and if you do run into it there's a way to just assign an alias to it as part of the declared reference (e.g. Even with that though there's the issue of your public API not having type hints being awkward to use in a project that requires them. Ideally the 'warn as error' setting would know it's referring to an addon, and apply the 'dont apply to addons' setting. But that's probably a lot more complicated than the current behavior, which is just path based. You could provide an alternative base class that has type hints perhaps, but that's maintenance on you. |
Some name-spacing would be great to have. One workaround might be to make your own scripts that extend scripts that do not have class names. This would work with
I'll be adding in the name in the next release as |
InputSender
is a variable inGutTest
which refers to an anonymous class inaddons/gut/input_sender.gd
. Since this class has no name, there is no way to refer to it in a static typing context, requiring copious amounts of ignore annotations:As an added side effect, it seems that code completion is also broken on the
sender
variable in Godot 4.I'm unsure what the right fix would be, as presumably adding a class name to
input_sender.gd
would clash with the variable name. Maybe the class could be namedGutInputSender
?The text was updated successfully, but these errors were encountered: