-
Notifications
You must be signed in to change notification settings - Fork 36
Immutable EnumSet #109
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
Immutable EnumSet #109
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Maybe it's also not too unreasonable to have EnumSet/Map and EnumSet/Map-Immutable classes, similar to DateTime and DateTimeImmutable, so users have the choice to use what they prefer. I'd say immutable is always to prefer because it doesn't come with side-effects which can lead to tricky bugs, but no one listens to me anyway :)
|
I'm not entirely sure about this. It would make sense only if both classes implement the same Interface. This means the interface would not make sure to handle immutable and mutable objects - in with DateTime and DateTimeImmutable. Let's fist see what are the performance differences |
56a84d2 to
d2c50e0
Compare
|
Here is the full benchmark: For me it tells me I should check where all the performance degrations comes from.
|
d2c50e0 to
4c41ffe
Compare
ad8f316 to
209f028
Compare
|
@prolic It's ready now :) I decided to have both mutable and immutable interfaces but with consistent naming:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for being late on this one, was moving around the globe. just one small remark.
209f028 to
85bbc20
Compare
Based on #108
EnumSetas immutableattach(): void->withEnumerator(): selfdetach(): void->withoutEnumerator(): selfsetBit(): void->withBit(): selfsetBinaryBitset[Le|Be](): void->withBinaryBitset[Le|Be](): selfPS 1: I still want to make some benchmarks for comparison
PS 2: This make sense only if we make
EnumMapimmutable too@prolic ping