> So the real issue is just that wrapping is the default while it would better 
> be explicit. Anyway, it's too late, we're stuck with this like Lua with their 
> 1-based indexing.

It's more that using unsigned values for lengths is a constant booby trap 
waiting to go off, regardless of how you deal with underflow; both underflows 
that result in silent errors and exceptions are generally unexpected and bad. 
I'm keenly aware of the issues involved and it still occasionally bites me in 
languages that use them this way (primarily C++). A C++ scripting library I 
wrote a while ago specifically uses signed integers for lengths in order to 
avoid this.

If you don't believe us, you can listen to what [Bjarne Stroustrup and Chandler 
Carruth are 
saying.](https://stackoverflow.com/questions/18795453/why-prefer-signed-over-unsigned-in-c).
 If you don't know who Chandler Carruth is, he leads the C++, Clang, and LLVM 
teams at Google.

Reply via email to