Boost logo

Glas :

Re: [glas] arithmetic operations

From: KF (fresl_at_[hidden])
Date: 2005-10-28 02:20:38


Andrew Lumsdaine wrote:

> [...]
> I really think that for mathematical libraries, the use of
> mathematical notation absolutely must conform to their mathematical
> meanings.

I agree with Andrew. And with Theodore and Wolfgang.

But to play a devil's advocate a little: one must admit that * only
resembles the dot which is used for scalar product of vectors in
mathematical texts (and that scalar product is in some texts written
simply as `uv', and sometimes as `(u,v)' or `<u,v>'). And also that
sometimes (often :o) someone wants to use * for some other
operation -- e.g. cross product -- maybe just because (s)he thinks
that `u*v' is more readable than `cross (u, v)'. And that we probably
will never really agree what should * mean.

Although in C++ new operators cannot be defined, there is one nice
trick from FC++ (http://www.cc.gatech.edu/~yannis/fc++/, described
in article `Syntax sugar for FC++') which can IMHO help: they
overloaded operator ^ to implement infix function call notation
which (they believe) is for some function names more readable than
prefix notation; so, they can write `u ^cross^ v'.

(But I am not sure whether it can be easily implemented without FC++
infrastructure.)

fres