Static typing cycles, "compiler time" types check

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Karol23

Hello,

I would like to ask some questions about static typing in GDScript. My background is pure C++. I have written a complete game in C++ in my custom engine with more than 100k lines of C++ code. So my point of view is possible biased :slight_smile:

I have learned that I cannot use static typing in two cross depended scripts. See https://forum.godotengine.org/57690/static-typing-scripts-cant-depend-other-cyclic-fashion-fatal

I do not want to repeat what have been told in the thread but I would like to ask if this problem will be solved in Godot 4. Because with this problem static typing is basically useless in GDScript for me. And as longtime C++ programmer I feel like naked without static typing. And honestly I am not sure I could manage 100k+ lines of code project without it.

Second question is about “compiler time” static types checking. If I understand GDScript corrently then even the static type checks are checked at runtime, meaning that if I have type error in some rare branch of code, I won’t be able to discover it in any simple way. Is there any tool or approach which would check the whole codebase for types errors?

Thank you for the answers. I really like the Godot approach of keep it simple but I feel very uncomfortable with GDScript static typing implementation.

:bust_in_silhouette: Reply From: LeslieS

Cyclic dependencies are addressed in GODOT 4 beta 6

It can be a pain to work around it but it really forces you to organize your code and not just drop reference variables everywhere.
However I definitely miss copy-constructors.