--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
When you need to remove something from a slice, the only thing you can do now is:
slice = append(slice[:i], slice[i+1:]...)
This is stupid because it's far beyond human logic: Why I need to make a new slice every time instead of just simply remove an element from the old one??
There is also another potential bug: if i+1>len(slice), it will cause panic. So you need to check it every time, which is also ridiculous.
So why not just simply provide a safe "delete" function just like in map?If there is any reason not to do it, please let us know.These words might seems offensive, but I was really annoyed about this problem for a long time, forgive me.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
When you need to remove something from a slice, the only thing you can do now is:slice = append(slice[:i], slice[i+1:]...)
This is stupid because it's far beyond human logic:
Why I need to make a new slice every time instead of just simply remove an element from the old one??
There is also another potential bug: if i+1>len(slice), it will cause panic. So you need to check it every time, which is also ridiculous.
So why not just simply provide a safe "delete" function just like in map?
Oh, so this is a rant about generics. OK.
I don't write those as functions or primitives, any more than I write increment as a function. YMMV.
Thomas