Can't we use a different data structure here?
The whole point of introducing SG-types is to get rid of those annoying double pointers and length variables