?? The only type in this list without a division operator is vector
all the others have it.

Matrix matrix, matrix vector, vector matrix division also not defined, there is one syntactic similarity but it is not division. Didn't give much of a thought to others since vector, matrix and scalar operations takes already quite a bit space.

        I'm sorry? What do you call the "generic case" here? All this list
shows is that each operator needs to be implemented individually
anyway. Andrei's point was exactly the reverse: he claims that most
operators can be implemented in groups which clearly isn't the case

I don't agree, majority of the cases you duplicate almost all of the code and just change the operator. That was the thing i meant with "generic case".
If i wasn't clear, say:

vector opBinary(string op)(scalar s) if(op == "+" || op == "-" ....) {
        static if(op == "/")
                return general("*")(1/s); // particular case
        else
                return general(op)(s); // general case, just a one-liner mixin
}

vector opBinary(string op)(vector v) if(op == "+" || op == "-" ....) {
        return general(op)(v); // again, just a one-liner mixin
}

Same goes for matrix, particular case being the multiplication.

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to