On Sat, Apr 18, 2015 at 10:03 AM, Nick Wellnhofer <[email protected]> wrote:
> Thinking more about this, I'd suggest to remove Shift and Unshift +1 We only use VA_Shift once in current Lucy, and we never use VA_Unshift. > // Instead of Shift. Removes element at `tick` and moves the > // following elements over. Shift(a) becomes Excise(a, 0). > incremented nullable Obj* > Excise(VArray *self, uint32_t tick); > > // Formerly known as Excise. > void > Excise_Range(VArray *self, uint32_t offset, uint32_t length); It seems to me that Excise is used infrequently enough that only the single function is needed. It's also a comparatively expensive operation because of all the copying, so better not to provide convenience functionality which encourages use. > // Instead of Unshift. Inserts `elem` at `tick` moving the > // following elements. Unshift(a, e) becomes Insert(a, 0, e). > void > Insert(VArray *self, uint32_t tick, decremented Obj *elem = NULL); +1, looks great! > // New method. Inserts `other` array at `tick` moving the > // following elements. > void > Insert_VArray(VArray *self, uint32_t tick, VArray *other); I like the semantics. I'd suggest the name `Insert_All`. Marvin Humphrey
