[proto] How to prevent function to be called for every evaluation of an expression?

2013-08-16 Thread Ole Svensson
Hi, for educational purposes I am implementing an EDSL for vector arithmetic and lazy evaluation which works quite nice (and fast) so far. But when I compile something like: Vector a, b, c; a = b + c + dotProduct(b, c); the result is computed correctly but dotProduct() is called for

Re: [proto] How to prevent function to be called for every evaluation of an expression?

2013-08-16 Thread Ole Svensson
What exactly is dotProduct? Is it a C++ function? If so, it will just get evaluated and the AST will contain the result of the evaluation. In that case I would expect it to only get evaluated once. How are you checking that it gets called multiple times? You might try setting a breakpoint in