Replies: 1 comment 5 replies
-
Collection already implements EnumeratesValues. I suggest 2 simple classes: ImmutableCollection and LazyImmutableCollection. the add/remove methods would do merge/except, and the magic offsetSet /offsetUnset methods would throw exceptions. you could easily do that yourself by the way. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
You can read in the documentation:
But that statemen is not true, because default collection implements
\ArrayAccess
interface. How about creating AbstractCollection (or trait) that holds most of the logic and have 2 child classes to represent mutable and immutable collections. For backward compatibility the name for mutable collection would stay the same and it would implement\ArrayAccess
whereasImmutableCollection
would haveadd/remove
would simply usemerge/except
under the hood.Beta Was this translation helpful? Give feedback.
All reactions