-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ByteBuffer amazingly fails to document that it's a value type :) #3037
Comments
I'm happy to help, but let's make sure that my assumptions are correct:
Any typical examples I should include? |
Not every struct has value semantics, so it should document that it does. This may be obvious/assumed by seasoned Swift programmers but I've had at least 3 people ask me if BB's a value type or not.
Impl. detail, doesn't need docs
Also technically an impl-detail but we should probably document that. Something like "ByteBuffer is a value type. The indices can always be modified without a copy of the underlying data. Any data modification may need to copy the contents using copy-on-write". Or similar
Yes, that's also good to point out.
Good idea! Yes, I think just something basic that shows it's a value type. I think like good journalism, we should lead with the important bit "BB's a value type" and then descend into more details. |
The ByteBuffer docs fail to mention that it's a value type. We should fix that.
Given that BB also has a few tricks up its sleeve (reader/writerIndex, self-slicing are part of the
struct
) we should also add that you can perform some mutations without even suffering CoW :)The text was updated successfully, but these errors were encountered: