This proposal is for adding a builtin splice function for adding/removing items in a slice:
splice(slice []Type, start, deleteCount int, elems ...Type) []Type
While the builtin append function can do everything that a splice function can, its a lot trickier to use for anything other than append, even by experienced go users. Newcomers to the language struggle with simple tasks of slice modification, and there are a lot of posted questions about them. It doesn't help that a function named append is supposed to be used for removing items from a slice.
On the other hand, people might be familiar with the splice function and its notation from other mainstream languages.
It doesn't seem like much, but it's a low hanging fruit that will help people new to the language.
This proposal is for adding a builtin splice function for adding/removing items in a slice:
While the builtin append function can do everything that a splice function can, its a lot trickier to use for anything other than append, even by experienced go users. Newcomers to the language struggle with simple tasks of slice modification, and there are a lot of posted questions about them. It doesn't help that a function named
appendis supposed to be used for removing items from a slice.On the other hand, people might be familiar with the splice function and its notation from other mainstream languages.
It doesn't seem like much, but it's a low hanging fruit that will help people new to the language.