Drachenfrucht1 / godotcord

A Discord Game SDK integration for Godot
https://drachenfrucht1.github.io/godotcord
MIT License
53 stars 5 forks source link

Use Signals instead of FuncRefs #55

Closed sairam4123 closed 3 years ago

sairam4123 commented 3 years ago

I feel like Signals has lots of advantages over function references.

Advantages:

  1. Ability to use yield function.
  2. Lot's of more advantages other than yield, I just forgot them, anyway.

Disadvantages:

  1. Lots of signals in codes. It's taking one line to register a signal. (It's not really a disadvantage though 😛)

I don't feel any advantages and disadvantages though. Maybe we could discuss further on it.

Thank you.

Drachenfrucht1 commented 3 years ago

After reading the arguments presented on the discord server, I agree that signals are the more common concept in Godot at the moment. For version 4.0, a new Object called Callable will enable developers to pass functions as objects. I don't know how this will affect the use of signals. But I assume that Godot 4.0 will break this module anyway so that we can decide this later for the 4.0 version of this module. As for the Godot 3.0 version, we can change all FuncRefs to signals. For naming: I would suggest either FunctionName_callback or FunctionName_signal.