I'm using the math/big
library in golang to perform operations on bit strings. Everything is working fine but I'm puzzled at why, for most of this library's functions, the syntax is:
var num1 big.Int
var num2 big.Int
var result big.Int
// Set num1 and num2
result.And(&num1,&num2)
Instead of:
var num1 big.Int
var num2 big.Int
// Set num1 and num2
result = num1.And(num2)
Since functions such as And
also return the result of the operation (https://golang.org/src/math/big/int.go?s=18912:18945#L798).
Why do you think this was the chosen implementation?
Could this be because of performance or well-known bad garbage collection? This is just plain curiosity, thanks in advance!