You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the project you are working on:
Making small programs to learn GDscript
Describe the problem or limitation you are having in your project:
I couldn't figure out why I couldn't change how my object was printed. I had forgotten to type return before the string.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
If _to_string had a default return type I would have cough the error immediately.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
_to_string should give an error if it doesn't return a string. I assume it could use the mechanisms that are used to catch mixmatch returns with declared return types. If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not that I know of. Is there a reason why this should be core and not an add-on in the asset library?:
It's most useful to new programmers that would have the experience to look for and install an addon.
The text was updated successfully, but these errors were encountered:
DrAlta
changed the title
_to_string should give an error if it don't return a string
Overwriten method should default to the same return type as the super class's method
May 9, 2020
DrAlta
changed the title
Overwriten method should default to the same return type as the super class's method
Overwriten methods should default to the same return type as the super class's method
May 9, 2020
Types are optional in gdscript, it's entirely possible you wanted to return a different type from the overridden function. From what I understand type checking doesn't go beyond the currently opened file right now. Adding a return type to the function definition would definitely warn you if you weren't returning.
A similar annoyance I've noticed though, is that if you extend a class that has an _init function you have to explicitly define the _init function again. It would be nice if it would use the _init function in the parent class.
Describe the project you are working on:
Making small programs to learn GDscript
Describe the problem or limitation you are having in your project:
I couldn't figure out why I couldn't change how my object was printed. I had forgotten to type return before the string.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
If _to_string had a default return type I would have cough the error immediately.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
_to_string should give an error if it doesn't return a string. I assume it could use the mechanisms that are used to catch mixmatch returns with declared return types.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not that I know of.
Is there a reason why this should be core and not an add-on in the asset library?:
It's most useful to new programmers that would have the experience to look for and install an addon.
The text was updated successfully, but these errors were encountered: