Replies: 3 comments 3 replies
-
I have a few viewers responding with confusion faces. I'm curious as to where the confusion lies. Perhaps this is a polite way of saying that they don't think that this is a good idea, or a valuable modification? It'd be great to get some clarification so that I know how to proceed. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Let's close, since the behavior was identified as a bug (godotengine/godot#74144). Thanks for the contribution nonetheless! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Currently, the getter / setter system requires that a getter function takes exactly 0 parameters and that a setter function takes exactly 1 parameter. If this is not adhered to then Godot errors with:
Function "X" cannot be used as setter because of its signature.
.If a getter or setter logically could or should take extra parameters, then the current solution is to write an alternative function with the same purpose, but taking those extra parameters.
Example - a solution that work with the current system
Proposal
My suggestion is to accept getter and setter functions that have more than the required number of parameters as long as the extra parameters are optional (i.e. they include a default assignment).
The benefit
If a getter / setter function logically could or should take extra parameters, then this proposal would allow it to, as long as the extra parameters have defaults that the getter / setter system can use. The advantage of this proposal is for more straightforward logic as it allows a having a single function for a single purpose rather than two functions for essentially the same purpose.
Example - a solution that takes advantage of this proposal
Beta Was this translation helpful? Give feedback.
All reactions