Skip to content
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

Rethink type system: Mutable vs Immutable #32

Open
patrickfav opened this issue Jan 12, 2019 · 2 comments
Open

Rethink type system: Mutable vs Immutable #32

patrickfav opened this issue Jan 12, 2019 · 2 comments
Assignees
Milestone

Comments

@patrickfav
Copy link
Owner

Currently the default type is described as "immutable" but in realty it's just a "copy-on-write" instance.

It would make more sense if the default instance is mutable, with wrapper to make it immutable.

@patrickfav patrickfav added this to the v2.0.0 milestone Jan 12, 2019
@patrickfav patrickfav self-assigned this Jan 12, 2019
@petrukhnov
Copy link

If purpose is performance, then mutability is important. If purpose is functional style, then it is easier to work with immutable data.

@patrickfav
Copy link
Owner Author

patrickfav commented Mar 7, 2019

The idea is to be mutable by default, as most simple use cases do not use Bytes as a type system (me guessing) - so you have the performance benefit without thinking about it. If, on the other hand, Bytes is used in APIs it would make sense to offer immutable types so an API may choose to protect it's internal arrays.

Im in the middle of the rewrite, but it is sometimes not easy to support both while having the some out-facing API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants