savi-lang / savi

A fast language for programmers who are passionate about their craft.
BSD 3-Clause "New" or "Revised" License
154 stars 12 forks source link

Change `Bytes` and `String` methods to prefer `USize` over `ISize`. #424

Closed jemc closed 1 year ago

jemc commented 1 year ago

The previous implementation of these methods copied from the Pony standard library the convention of using ISize for specifying a range in this kind of data structure, treating negative offsets as being offsets from the end of the collection.

This change makes it so that they always use USize, making it easier to have compatible values with other methods that use USize, so as to avoid needing to translate between USize and ISize.

Now, if you want to do an offset from the end of the collection, you'll need to do it yourself at the caller side.