rust-num/num-complex

Complex::from_polar takes reference arguments

SamiPerttu opened this issue · 3 comments

Because Complex::from_polar is a constructor, it should follow the same conventions and take arguments by value, like Complex::new does.

On one hand, I think references make sense because from_polar has to perform a conversion, so even though it's a constructor, it's not really consuming the arguments. However, I'm somewhat inclined to make all of the T: Float methods take values instead of references, since that already implies T: Copy too. (It's also redundant that they're specified as T: Clone + Float.)

As far as I can see, all the other methods take values already. from_polar appears to be the only T : Float method taking references.

They all use &self method receivers, but could just take self by value.