3 ms·
> This is a pretty standard data structure in most languages. Yes, vectors are common, but they don't typically require compiler modifications to avoid mis-usi
by SomeOldThrow 7y ago
> This is a pretty standard data structure in most languages.
Yes, vectors are common, but they don't typically require compiler modifications to avoid mis-using them. In this case I'd make it super clear whether the method mutates the existing value or returns a new one, and "possibly both" seems like the worst of both worlds. If this behavior is preferred, it seems like `append` should take a handle to a slice pointer, possibly to a slice rooted in the stack, and write to it if replacing the underlying slice.