You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The proposal would be to introduce a new type: type IntMut Int which can be converted from and to Int with little to no overhead by doing (IntMut)(Int) and vice-versa (Int)(IntMut), then the mutative API would be implemented on top of IntMut, this would reduce the API surface of Int which is already big and support the mutative API in a performant way.
Eg:
typeIntMutIntfunc (iIntMut) ToInt() Int { return (Int)(i) }
func (iIntMut) Quo/Add/Sub/Etc() { ... }
func (iInt) ToIntMutUnsafe() IntMut { return (IntMut)(i) }
func (iInt) ToIntMut() IntMut { returnNewIntMutFromBigInt(i) } // this NewIntMutFromBigInt would copy the underlying Int.bigInt
Summary
There has been a need for more mutable apis in math, they have been getting added to the current struct which could cause confusion for users.
Problem Definition
separate immutable from mutable in math
Proposed Feature
Create a new mutable struct for users to use when needed.
New api to add:
The text was updated successfully, but these errors were encountered: