Replies: 2 comments
-
See:
This is problematic to implement, given that different functions are called differently. For example, GDScript functions support non-constant parameter initializers, so we cannot evaluate missing optional parameters in advance and patch the call arguments. And dynamic typing does not allow us to always know which function will be called. |
Beta Was this translation helpful? Give feedback.
-
I've thought about it in the past. I thought about using the I am aware that built-in functions in the API would heavily benefit from this, especially the server classes. As the API is currently, it would really be awesome. Generally speaking, though, functions with a huge amount of parameters are bad practice and should be discouraged. In an ideal world, we would be uniting these parameters in a struct, but as of writing this it's not possible. See also Dalexeev's response, implementation-wise. |
Beta Was this translation helpful? Give feedback.
-
Problem:
I've experienced multiple cases where it would be preferable to skip setting a parameter when calling a function.
Example:
This is a function I created to instance nice looking scene transitions, and it has a few configurable options.
However, sometimes I would like to change the
fake_delay
while keeping theoverlay_speed
the same as the default value (in case it changes in the future.)You might tell me to simply swap the
fake_delay
andoverlay_speed
around, but that creates the opposite issue where I would want to changeoverlay_speed
but have to setfake_delay
to a hard value.Let's look at what I have to do if I would want to change
fake_delay
without changingoverlay_speed
:Proposed Solution:
Have a way to simply use the default value of an argument through a character.
I.e.:
Beta Was this translation helpful? Give feedback.
All reactions