-
Notifications
You must be signed in to change notification settings - Fork 22
Slice Redesign
Currently, slicing a ManagedArray returns a ManagedArray.
Advantages: Single type to deal with. Current approach.
Disadvantages: Users can call methods to resize or free slices. The implementation has to do different things based on whether dealing with a slice or an actual array. CHAI has to make the choice of whether calling resize on a slice is a no-op (scary for users) or an exception (also annoying for users).
Recommended: Have a separate view type that doesn't have methods for resizing or freeing.
We have algorithms that have to do different things based on whether the ManagedArray is a slice (e.g. sort_uniq), but at the moment that has to be handled by an extra parameter.
The major change would be passing a view to functions and only actually passing an array when the size needs to be changed or it might be freed.