Closed mujtaba-io closed 2 weeks ago
My above comment might be confusing. So this is the possible syntax that I am thinking about:
Of course, these proposals are slightly different, but I think they have a common essence: declarative connection of a signal to a method instead of using connect()
or the editor, some shorthand in the form of a keyword or annotation.
Describe the project you are working on
I am working on many small games that are event driven.
Describe the problem or limitation you are having in your project
I have to use
my_signal.connect(my_func)
and i have to emit it using
my_signal.emit()
And it is tedious for large amounts of signals.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I think a syntax to recieve a signal could be like this (more convenient):
and signals are emitted using:
emit my_singal
And we dont have to explicitly define
signal my_signal
as it will be inferred by the names being common in emit/listens statements. Or we can make it appear more like interrupts or exceptions that can be catched or thrown.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
NA
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes, used often.
Is there a reason why this should be core and not an add-on in the asset library?
Yes, it is related to GDScript.