Skip to content

Conversation

SeremTitus
Copy link

Works under the following assumptions:

  1. The number of arguments passed to emit or emit_signal must not exceed the number of parameters defined in the signal.
  2. The types of arguments passed must match the types of the corresponding signal parameters. (excluding passing Variant)

Encourages more consistent code.

@SeremTitus SeremTitus requested review from a team as code owners September 22, 2025 11:18
@Mickeon Mickeon added this to the 4.x milestone Sep 22, 2025
@dalexeev
Copy link
Member

Thank you for your efforts, but please note that this only affects the static analyzer and does not provide runtime guarantees for untyped code. In the current implementation, Godot/GDScript provide runtime guarantees for all types except enumerations. (Plus, type hints for signal parameters are declarative.)

Adding appropriate checks to the core methods connect(), emit_signal(), and so on will incur some runtime penalty. Optimization will require multiple versions of these methods: a safe but slow one (for the general untyped case) and a fast but unsafe one (for arguments validated during static analysis). So we need to weigh the pros and cons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants