Re: operator overloading
On Mon, 12 May 2008, Mark Space wrote:
Patricia Shanahan wrote:
Neither having nor not having operator overloading is risk free. The
question, on which reasonable people can disagree, is which carries the
higher cost.
Right. So the important thing I think is to admit that we disagree, and try
to find some ground where we might agree.
Is there anything less that full C++ style operator-overloading that would
meet your current requirement? There's a fair number of operations on
matrices that don't use the simple style of algebraic operators that simple
numbers use. (My poor little brain strains to remember them, however.)
Should we look for a way to include those notations, and may be extend that
to more maths?
Can we have some set of operators that you feel you really need, and
some that would be just "nice to have?" Are their any that you
definitely do not need to overload?
We need +, -, *, /, %, and unary - for the various kinds of complicated
number. Also >, >=, <, <=; ideally, == and !=, but it's far too late for
that now. Maybe we need === and !== instead. Maybe not.
We need [] and []= (ie foo[bar] = baz) for composite things like matrices,
and possibly collections.
I'd quite like to be able to use &, |, and ^ on sets. Possibly also &=,
|=, ^=.
I'd like to be able to gently abuse | and ^ for vectors. If i have * as a
dot product, i can use ^ for cross product and | for the resolute.
So (with assigning forms being implied):
essential: +, -, *, /, %, >, >=, <, <=, [], []=
nice: &, |, ^
i personally don't want: ++, --, !, ~, &&, ||, ternary operator
must not have: =, .
I'd probably throw ++, --, ! and ~ into the bag, just for completeness.
But leave the logical operators out.
tom
--
When you mentioned INSERT-MIND-INPUT ... did they look at you like this?