Allow custom classes to define their own operator behavior (operator overloading)
### Describe the project you are working on A Mandelbrot set visualization tool ### Describe the problem or limitation you are having in your project This project requires the use of complex numbers (with a real and imaginary component). Godot, understandably, does not support complex numbers, so a custom class is needed to represent them. However to do something involving math for these complex numbers (e.g., addition), I have to now write and call custom functions to do this, instead of using the built-in math operators. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation The feature enhancement would allow custom classes (such as the complex number class described above) to define their own operators so that standard mathematical (or other) operators could be supported. ### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams I propose this should work in a similar way to Python's current implementation. This would involve having pre-defined function names for the operators that, when implemented, would open up the ability to perform those operations, with the behavior tied to the function's implementation. Essentially, this would be "syntactic sugar" that converts certain operators to a function call, if present. This is also in keeping with GDScript's other paradigms for class functions such as `_init`, `_process`, `_draw`, etc. where defining those function allow someone writing GDScri
Posted by TheCleric on Nov 9, 2023, 6:53 PM
Tags
Related issues
- some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
- I think of this as the kiosk economy.
- What a goofy comment.
- There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
- Compose support in WSLc
- [RFC] Roadmap to v2.0
Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments
support (Other)
some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
I think of this as the kiosk economy.
What a goofy comment.
There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
Compose support in WSLc
[RFC] Roadmap to v2.0
[Feature]: Add TurboQuant Support for KV Cache Quantization
Support for AGENTS.md and .agents/skills/, the community has been asking since August 2025
Allow custom classes to define their own operator behavior (operator overloading)
### Describe the project you are working on A Mandelbrot set visualization tool ### Describe the problem or limitation you are having in your project This project requires the use of complex numbers (with a real and imaginary component). Godot, understandably, does not support complex numbers, so a custom class is needed to represent them. However to do something involving math for these complex numbers (e.g., addition), I have to now write and call custom functions to do this, instead of using the built-in math operators. ### Describe the feature / enhancement and how it helps to overcome the problem or limitation The feature enhancement would allow custom classes (such as the complex number class described above) to define their own operators so that standard mathematical (or other) operators could be supported. ### Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams I propose this should work in a similar way to Python's current implementation. This would involve having pre-defined function names for the operators that, when implemented, would open up the ability to perform those operations, with the behavior tied to the function's implementation. Essentially, this would be "syntactic sugar" that converts certain operators to a function call, if present. This is also in keeping with GDScript's other paradigms for class functions such as `_init`, `_process`, `_draw`, etc. where defining those function allow someone writing GDScri
Comments (0)
No comments yet. Start the discussion.