-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Currently, int is allowed as index for indexed types (arrays and strings). The reason we can't restrict this to uint is that we want to be able to use expressions like - n 1 as indices. The current implementation of the - operator types to int even if both operands are uint because the result of a subtraction may be negative.
A possible solution is to implement proper 32- or 64-bit unsigned integers and wrap around when a negative value is produced, but this would raise the problem of deciding the width. A possible solution to this would in turn be to provide both 32-bit and 64-bit integer types.