Johann Pardanaud
07/14/2023, 3:15 PMUInt type for String.length or Collection.size? Is this for JVM compatibility? Is it safe to assume those values will never be negative?mkrussel
07/14/2023, 3:22 PMInt. It also predates UInt so changing it would be a pretty breaking change.
repeat(list.size - 1 {} would not compile anymore, one of the numbers would have to get casted. It's better than old languages where mixed type maths were allowed and you end up with the maximum UInt if size was 0.
I think it is safe to assume that it will not be negative. But a custom collection could do something very broken.Charles Flynn
07/14/2023, 3:23 PMJohann Pardanaud
07/14/2023, 3:24 PMBut a custom collection could do something very broken.I did not thought about that, you're right, it could bring some issues. 😬
Charles Flynn
07/14/2023, 3:26 PMJohann Pardanaud
07/14/2023, 3:27 PMAlexey Belkov [JB]
07/17/2023, 8:11 AMWhile unsigned integers can only represent positive numbers and zero, it’s not a goal to use them where non-negative integers are required by application domain, for example, as a type of collection size or collection index value.
Johann Pardanaud
07/17/2023, 8:34 AM