OK, I could be horribly mistaken here, but Ruby only uses the basic
operators (such as *) and then translates a *= b into a = a * b

If you need a different behaviour for a *= b than a = a * b, then you're
going to need to implement it using a different method than operators.

Also, if you're worried about speed of the operation (working with
matrices, I'm assuming you very well may be), I'm sure that a = a* b
woudl be a lot slower than a special *= operator, so you might want to
try to handle as much of that in C++ than in Ruby as you can.

In Ruby, though, you need to implement the * operator (just as you would
the + operator), and yes you need to return the value.

Sean Etc.

On Sat, 2001-10-13 at 12:42, Bernhard Glk wrote:
> Hi there!
> 
> I am exporting a class from C++ to ruby, this works fine ( i got much
> help from this group already) I still have one question, i export a
> Matrix class which is quite complete with overloaded * = etc
> opertators in C++, but how to export them to Ruby ?
> I heard it could be done like this: 
> 
> rb_define_module_function( GetModule(),"+",SE_METHOD( ScriptVectorPlus
> ),1 );
> 	
> But my question is which operators can be defined this way ? And what
> are their prototypes ( e.g does *= exist ? Does it require to return a
> value or not ? ) I could not find any reference Docs on this....
> 
> Thanks 
> Bernhard Glk