IssueRaiser

Implement method overloading in GDScript

<!-- Please fill in *all* the questions below and don't remove any of them. Proposals not following the template below will be closed immediately. --> **Describe the project you are working on:** gdscript plugins **Describe the problem or limitation you are having in your project:** I often need to create similar methods that do similar things (and even usually return the same type), but differ in arguments (their number or their types). The problem is that the more subtle the difference between the two methods, the more difficult it is to come up with a clear and concise names for the methods. In addition, it is highly likely that in this case the methods will contain unnecessary redundant information that could easily be obtained from the methods signatures. On the other hand, creating a single method using optional parameters partially solves the problem, but this creates difficulties in further extending the method, forcing to create a confusing code with a large number of `if` statements, and ultimately degrade the readability and support of the method. **Describe the feature / enhancement and how it helps to overcome the problem or limitation:** Implementing method overloading in gdscript would solve this problem in most cases **Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:** Perhaps one of the most beautiful illustrations of how convenient method overloading is, is the `Color()` methods. ![Color](https://user-images.github

Posted by me2beats on Sep 26, 2020, 7:52 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

ux (Software)

Implement method overloading in GDScript

me2beatsSep 26, 2020, 7:52 AM

<!-- Please fill in *all* the questions below and don't remove any of them. Proposals not following the template below will be closed immediately. --> **Describe the project you are working on:** gdscript plugins **Describe the problem or limitation you are having in your project:** I often need to create similar methods that do similar things (and even usually return the same type), but differ in arguments (their number or their types). The problem is that the more subtle the difference between the two methods, the more difficult it is to come up with a clear and concise names for the methods. In addition, it is highly likely that in this case the methods will contain unnecessary redundant information that could easily be obtained from the methods signatures. On the other hand, creating a single method using optional parameters partially solves the problem, but this creates difficulties in further extending the method, forcing to create a confusing code with a large number of `if` statements, and ultimately degrade the readability and support of the method. **Describe the feature / enhancement and how it helps to overcome the problem or limitation:** Implementing method overloading in gdscript would solve this problem in most cases **Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:** Perhaps one of the most beautiful illustrations of how convenient method overloading is, is the `Color()` methods. ![Color](https://user-images.github

Comments (0)

No comments yet. Start the discussion.

Comment on this issue