← Back to context

Comment by __s

1 year ago

By returning nil, the function makes it clear that it doesn't move the input reference

Yes, but now I have to keep track of which functions invalidate-and-return and which return nil. If I forget that `slices.Delete` returns a new slice instead of mutating in-place, the language doesn’t help me.