Operator Overloading (Missing feature?)

General help with the eC language.
Post Reply
redj
Posts: 105
Joined: Sun Jan 17, 2010 10:03 am

Operator Overloading (Missing feature?)

Post by redj »

Question from JF:
Operator overloading?

Note that A little introduction to eC mentions operator overloading.

-redj
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Operator Overloading (Missing feature?)

Post by jerome »

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.
Attachments
test.units.ec
(3.81 KiB) Downloaded 961 times
Post Reply