I think that enforced strict typing should allow for no return type to be inferred as void

@pauldrewett Technically I do not think GDScript can ever be considered Strongly Typed because you can use a Variant as a type, which gets around strong typing. Statically Typed is technically for Compiled Languages. GDScript, even when exported, is an Interpreted Language. You could make an argument for it being statically typed, but depending on the semantics of the discussion, the definition wouldn’t fit. It is Strictly Typed because it insists that every variable have a type.

I actually turned this feature on for the first time today in warning mode for one of the games I’m working on, and I had 30 warnings, most related to for loops and Array/Dictionary declarations.

1 Like

@dragonforge-dev Strongly typed languages also have dynamic constructs and circumvention of the type system. C# has dynamic/unsafe, C/C++ have void ptrs. The line is drawn by the users of the language, you as a programmer decide whether to use certain features or not and enforce them project wide.

Thank you.

The first time I turned it on with a previous game I got about 500 warnings to work through! I always have it on now.

I don’t miss JS days of:

"5" + 2 # = "52"
"5" - 2 # = 3

Anyway, much appreciated.

2 Likes

Which shows it’s short sighted and poorly thought out. Not taking into account the entirety of the language, its main design principles and its typical usage is not really responsible towards the user base. And all this just to avoid typing 4 letter word here and there. I mean your main and pretty much only argument was:

The design decision to enforce void with static typing bloats the code.

Bloat? Really?

The thing you insistently gloss over is introduction of semantical inconsistencies by switching a compiler flag. That’s likely because you’re biased towards strongly typed languages and are only willing to look at GDScript through that lens.

I can’t keep up with your fisking. It’s a discussion killing tactic. Either drop that, or take your proposal to Godot’s github and see how devs react to it. Maybe you’ll be willing to listen to authority since you’re not listening to reason.

Do you have any constructive criticism?

I disagree with the semantical inconsistencies you claimed happen, i explained how every case is still consistent.

I don’t understand what you mean by frisking, if you have a concrete example of code, or something that can be argued about in objective terms please present it. I think i was being constructive all the way through, arguing points and not resorting to personal attacks or attributing other people something that is not there like you just did.

1 Like

Fisking not frisking. Look it up.
I lost. You won. The idea is excellent. Make the official proposal.

The doors are open if you decide to come back and argue constructively. So far nobody presented an argument that would adamantly block this idea. I am not yet ready to propose anything on github as I am not yet sure it is a good idea.

There are no counter arguments, except the ones you “disagree” with and those as we all know don’t count. Therefore it’s an excellent idea. We can continue the discussion under your proposal on github.

I can come up with an example of how you can hack any language to subvert these things. It does not change the overarching definition.


@codingus This is your first post in the forum. This indicates that you haven’t most likely actually been using Godot that long. You are recommending a very specific, very impactful change to how a language works without having used it very long. Even if that’s not true, that’s the vibe you are putting out.

I happen to know that between @normalized and myself, we have 60+ years of professional development experience. Add in one of the lurkers who has been liking our posts, and we have a combined 90+ years of professional experience in programming. We also have experience with using Godot that I do not think you have.

Perhaps you do not mean to, but your replies in this post have come across as very myopic, and your arguments as very disingenuous. You use logical fallacies in your arguments, and refuse to engage in any meaningful way.

@normalized and I disagree all the time in threads here, but we are both able to respect each others’ opinions, and admit when we are wrong or when we have learned new information we didn’t know before. We are also able to agree on things.

The fact that you ignored my advice to open up a ticket about this indicates you are more interested in trolling or having some pyrrhic victory than engaging. I unsubscribed from this thread a few hours ago unless tagged, and I am turning that off too.

1 Like

Thanks, if you have anything constructive to say on the topic please go ahead.

Make the proposal. This will require thinking about actual pros and cons, and elaborating all of the specifics. I’d like to see that. You don’t need to go to github immediately, you can test drive it here first.

I agree with @dragonforge-dev and @normalized.


Case: Let us think like a totally beginner.

Beginners typically won’t change the settings, meaning Untyped Declaration will retain the default “Ignore” at first.

For example, if we already have two functions here before:

func foo():
    pass
func foo_return():
    return 1

Then, when I set the Untyped Declaration to “Error”:
:collision:We got errors! Let’s fix it.


:pencil: The original Godot GDScript rules is very clear and straightforward.
Beginner just need simply adds some meaningful type keywords (“-> void”, " → int", etc…) to each function.

:play_button: Since no return indicates “no return value", just add"→ void".

func foo() → void:
    pass

:play_button: Since return an int indicates “int return value”, just add"→ int".

func foo_return() → int:
    return 1

:white_check_mark: No error here, and beginners can finish modification easily and quickly.


:pencil: But, the @codingus version may cause the following obfuscations.

:play_button: Based on @codingus’s logic, beginner may think like:
:play_button: Since no return indicates “no return value".
:play_button: Since no -> sometype: indicates “no return value".
:play_button: It can be inferred, so No Need to change.
:play_button: It’s totally the same as no changed (Beginner may confuse here, Is this function typed?)…

func foo():
    pass

:play_button: Based on @codingus’s logic, beginner may think like:
:play_button: (1). It can be inferred. Since no -> sometype: indicates “no return value”…
:play_button: (2). It can be inferred. Since the function returns an int indicates “int return value”…
:play_button: So, how to determine? Use (2), but why?
:play_button: In fact, no matter which one. Since may have to determine from more than one choices, it will use more time to do this. And for beginner, it means have more confused.

func foo_return() -> int:  
    return 1

:white_check_mark:No error here, but beginner may confuse why sometimes have to add “-> sometype”, but sometimes no change ? What actually means if “Untyped Declaration set to Error”?


So, If I can choose, I like Godot’s original way.

1 Like

I agree with the confusion it may introduce if it’s conflated with Untyped Declaration, but as a dedicated flag, clearly named like Untyped Declaration - Void return inferred with clear description it works imo.
I’m thinking about implementing it myself to see what challenges arise.
Thanks for your input.