chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.79k stars 420 forks source link

[Library Stabilization] BigInteger operator methods should have better argument names #17725

Open lydia-duncan opened 3 years ago

lydia-duncan commented 3 years ago

All the operator arguments are named a and b except for the exponentiation and assignment operators which have appropriate names. I think these should be lhs and rhs as appropriate, and arg for unary operators.

If folks agree, I think we should update the standard module guidance to recommend this.

bradcray commented 3 years ago

I agree we should come up with a standard practice here (and then apply it to ChapelBase and the like).

I wouldn't use lhs and rhs for the two operands to a + operator, say, because in programming, I think of lhs as meaning "the thing to the left of an assignment operator", not the first input argument to a binary math operator. But I'd be open to using those as the names for a = or += operator.

For a case like +, I'd also be up for using:

For the previous bullet's reason, this question probably matters a lot more for operator-like methods in BigInteger like .add() since they can be called using pass-by-keyword.

lydia-duncan commented 2 years ago

18650 is related

jabraham17 commented 1 year ago

22008 is related

lydia-duncan commented 1 year ago

We've decided not to adjust these for 2.0 since operators can't be called with named arguments. Removing the 2.0 label