On 19/09/2013 03:29, Marvin Humphrey wrote:

Changes from the old SubString method:

*   Change of capitalization from "SubString" to "Substring".
*   Parameter "len" renamed to "length".
*   Parameters are now int64_t rather than size_t.
*   Parameters now have defaults.

I can see the rationale for moving to a signed type but I wouldn't use a 64-bit type. If we move from size_t to int64_t, we should use int64_t consistently for offsets and lengths measured in code points:

* Str#Length should return an int64_t.
* Str#Find already returns an int64_t.
* StrIter#Advance and StrIter#Recede should take and return
  an int64_t.
* StrIter#Skip* should return an int64_t.

This would unnecessarily complicate things on 32-bit systems where strings can't be longer than 2^32 bytes. I know that we don't optimize Lucy for 32-bit but Clownfish is a more general purpose system, so I'd prefer something like ssize_t.

Nick

Reply via email to