Signal param handler overly strict?

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?

You can unbind the arguments, though you are right more complex unbinding (say only the second argument) requires a new function or lambda

extends Button
func _ready() -> void:
	Events.wave_started.connect(self.hide.unbind(1))

In theory it should work if you give it a lambda:
extends Button

func _ready() -> void:
	Events.wave_started.connect(func(): self.hide)

Is this a custom signal? If so and you aren’t using the parameter, don’t give it one.

I’m emitting the parameter. Other listeners need the parameter, this one in particular doesn’t

An inline lambda or the unbinding are both elegant shorthand solutions :+1: