[fpc-pascal] Re: operator overloading and counting references / creating / destoying anonymous instances
Jürgen Hestermann
juergen.hestermann at gmx.de
Sat Jul 30 17:05:50 CEST 2011
> > 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.
> No, I don't agree at all. The procedure call clearly shows me that a
complex calculation
> is done instead of an (atomic) add and division command on numbers.
And there is another advantage of using procedures/functions instead of
overloading operators:
You can search for the procedure to look what it actualy does.
How do you find the code that overloaded an operator?
More information about the fpc-pascal
mailing list