3 ms·
forgive my ignorance, why is operator overloading particularly useful in scientific computing?
by mattyw 12y ago
forgive my ignorance, why is operator overloading particularly useful in scientific computing?
- aaronblohowiak 12y agoSo your code can still look like math when the operands are complex types.
- NateDad 12y agoBecause it lets your math code look more like math and less like code. v := Vector{} v2 := Vector{} to add the two vectors, currently you have to do something like result := v.Add(v2) rather than the nicer result := v + v2 In the small scale, it doesn't seem like a big deal. In a large and complicated scientific program, it can make the code a lot harder to read. Note: I think it is good that Go does not have operator overloading, though I think it's a shame that means it's not as good for scientific & math programming.