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
Context: this is an optional and breaking suggestion
Currently, most APIs use BigInt or number | BigInt to represent the promise indices, which is very prone for misuse.
Take:
export function promiseBatchActionTransfer(promiseIndex: number | BigInt, amount: number | BigInt)
This function makes it very easy to swap the order of these and cause a bug at runtime either from unexpected behavior or a panic at runtime if the promise index does not exist.
There should be no way to manually construct a promise index, so it would be preferred if promiseCreate and other related functions returned a class/object that are only constructed by those functions. This would allow those bugs to be caught at compile time when using TS and runtime if using JS (but friendlier runtime error than if this wasn't done).
A lot of these APIs are way too easy to misuse, which will cause issues for people.
The text was updated successfully, but these errors were encountered:
Context: this is an optional and breaking suggestion
Currently, most APIs use
BigInt
ornumber | BigInt
to represent the promise indices, which is very prone for misuse.Take:
This function makes it very easy to swap the order of these and cause a bug at runtime either from unexpected behavior or a panic at runtime if the promise index does not exist.
There should be no way to manually construct a promise index, so it would be preferred if
promiseCreate
and other related functions returned a class/object that are only constructed by those functions. This would allow those bugs to be caught at compile time when using TS and runtime if using JS (but friendlier runtime error than if this wasn't done).A lot of these APIs are way too easy to misuse, which will cause issues for people.
The text was updated successfully, but these errors were encountered: