Question from JF:
Operator overloading?
Note that A little introduction to eC mentions operator overloading.
-redj
Operator Overloading (Missing feature?)
Re: Operator Overloading (Missing feature?)
I believe I meant to talk about eC's great unit systems and conversion properties in that little introduction.
This supports things like:
Degrees a = Radians { pi/4 } + Degrees { 60 };
(See attached 'units' test)
It's another way eC advocates 'clear execution points', one thing happening only at one place.
(As opposed to e.g. overload a + and += and - and -= operator, in eC you simply define a conversion function to go to reach a 'common ground, and then the regular C operators work).
The PrintLn syntax mentioned there is eC's alternative to the C++ cout << a << b;
Now operator overloading would be useful for things like vector , matrix and quaternion operations.
For this, we hope to develop some kind of operator overloading support, but that is not done yet.
Our Utopian 'String' class is still something eC is missing, and whether it will overload the + for concatenation or not is still to be disputed.
This supports things like:
Degrees a = Radians { pi/4 } + Degrees { 60 };
(See attached 'units' test)
It's another way eC advocates 'clear execution points', one thing happening only at one place.
(As opposed to e.g. overload a + and += and - and -= operator, in eC you simply define a conversion function to go to reach a 'common ground, and then the regular C operators work).
The PrintLn syntax mentioned there is eC's alternative to the C++ cout << a << b;
Now operator overloading would be useful for things like vector , matrix and quaternion operations.
For this, we hope to develop some kind of operator overloading support, but that is not done yet.
Our Utopian 'String' class is still something eC is missing, and whether it will overload the + for concatenation or not is still to be disputed.
- Attachments
-
- test.units.ec
- (3.81 KiB) Downloaded 2020 times