Godot Version
4.3
Question
Let’s say I have a signal in an Events Node
signal wave_started(wave: int)
And a button that hides itself on that signal,
extends Button
func _ready() -> void:
Events.wave_started.connect(_wave_start)
func _wave_start(wave):
self.hide()
It would be convenient if the signal could be written like this,
extends Button
func _ready() -> void:
Events.wave_started.connect(self.hide)
Unfortunately, the second syntax silently fails at runtime, as Godot will pass over the event handler due to mismatched param structures.
From an outside perspective, it seems like Godot should be capable of discarding the unused params and calling the handler anyway (JS does this, I’m sure other dynamic languages do too). Barring that, it seems like Godot could error on .connect for a mismatched handler, or error when the signal is sent. Any of the options would, in my experience and opinion, be preferable to tracking down silent failures.
Thoughts? Anyone know if this is a bug in behavior or would this be a new feature proposal?