-
Notifications
You must be signed in to change notification settings - Fork 16
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
Combine Record and ImmutableMap #11
Comments
Well what's interesting with Records is the ability to grab fields as usual However, just as object, records should definitely accept |
Symbols, are something that should definitely be added to the proposal. About merging Records and Immutable Maps, I still think it's worth exploring, unless there is a strong to be made about performance. It is true that you don't need to use Using the dot operator is something I'm not too keen on having. Immutable data structures are about data. Records aren't going to replace objects in code, but they provide a better way to store data. |
I think there is a clear separation between Records and ImmutableMaps. Even though Records could be written in terms of ImmutableMaps, by keeping the API as small as possible for it, there is essentially no distinction between it a frozen object. Values are accessed through normal property access and it otherwise works as an ordinary object as long as you don't attempt to mutate it. Also, each "type" of Record would have its own distinct API. ImmutableMaps, on the other hand, have arbitrary-typed keys (not necessarily strings), and a generic API with extra capabilities (such as deleting an entry), not specific to any particular instantiation of an ImmutableMap. Two ImmutableMaps from completely separate parts of the code have the same, obvious API. They solve different problems. |
The combined type would work the same way as OrderedMap in Immutable-js
Since Records are about Data, it doesn't make sense to keep them limited to strings for keys.
Would like to know if there is a performance story to be made about Records.
The text was updated successfully, but these errors were encountered: