[fpc-pascal] Re: operator overloading and counting references / creating / destoying anonymous instances

Henry Vermaak henry.vermaak at gmail.com
Fri Jul 29 12:31:47 CEST 2011


On 29/07/11 06:39, J├╝rgen Hestermann wrote:
>
>
> Bernd schrieb:
>  > Occasionally I hear other people mentioning operator overloading as a
>  > must-have feature of any decent language but I wonder what real-world
>  > problems they are actually solving with it.
>
> I think operator overloading is a pain. As you said: What is the
> advantage? For me operators should be defined by the language only

It improves readability, making it more logical.  Say for instance you 
are working on Galois fields and you have to do arithmetic on the 
elements like this:

g1 + g2 / g3

If you don't have operator overloading, you have to do it with 
functions, like this:

gf_add(g1, gf_div(g2, g3))

This is not very readable, I'm sure you will agree.  They have to be 
used carefully, however.

> clear. But now there is no way back. It's implemented. Pascal moves in C
> direction...

Troll.  C has no operator overloading.

Henry



More information about the fpc-pascal mailing list