Why aren't non-existent functions detected at compile time? #5549
Replies: 2 comments 4 replies
-
I don't think it's a bug – it's just a missing static check. Implementing this for built-in types may be possible, but not trivial. |
Beta Was this translation helpful? Give feedback.
-
In theory, you can assign to The following code is also valid, although not type-safe: var node: Node = Label.new() # OK, Label inherits Node.
node.name = "MyNode" # OK, type-safe. Node.name exists.
node.text = "test" # OK, but not type-safe. Node.text does not exist, but Label.text exists.
node.lalala = 123 # OK, but not type-safe. Runtime error. If you want more strict checks, you can change these settings: |
Beta Was this translation helpful? Give feedback.
-
I have to ask this after godotengine/godot#66943
Look at this example
Why does it even compile? It's obvious that it will crash/error on runtime, the function
.instance
does not exist..instantiate
does, and works.While I am curious to know, with my limited knowledge of Godot I do think it's a bug (python works like this but python isn't in this project), but I want to confirm hence I ask. After all, static compilation does happen, but I guess some of it is offloaded to runtime?
Beta Was this translation helpful? Give feedback.
All reactions