ponylang / rfcs

RFCs for changes to Pony
https://ponylang.io/
61 stars 48 forks source link

Add operators for partial integer arithmetic #125

Closed mfelsche closed 6 years ago

mfelsche commented 6 years ago

Rendered

mfelsche commented 6 years ago

I know this is kinda controversial, but i wanted to give it a shot anyway.

Fight!

winksaville commented 6 years ago

I like the general idea of allowing the users to write safe/correct code and the consistency this proposal provides for all operators is nice.

mfelsche commented 6 years ago

@jemc yeah, i forgot that section. I updated the RFC. thanks for checking.

sylvanc commented 6 years ago

I like this. If I'm not here when a vote happens, I vote yes.

Also, in the context of how Matthias explains these operators, do we want to revisit calling the ~ operators _unsafe ?

codec-abc commented 6 years ago

I would like to add that using BigInteger and some static types check may be an alternative since they can't overflow/underflow and a smartly enough compiler may be able to prove when the denominator may be different than 0 to safely allow a division. The disadvantage of this technique is that is mostly shift the problem to the point where it may be needed to convert a BigInteger to a different size with a smaller capacity.