Re:Ruby adds a new core Data class to represent immutable va...
by sacnoradhq on Wednesday November 30, 2022 @02:58AM
(#33798121)
Concurrent::ImmutableStruct is thread-safe and tested. Dry is cute, but too new.
Re:Ruby adds a new core Data class to represent immutable va...
by bhaak on Wednesday November 30, 2022 @03:40AM
(#33798360)
5 years old is too new? concurrent-ruby is only 3 years older.
Re:Ruby adds a new core Data class to represent immutable va...
by bigtunacan on Wednesday November 30, 2022 @09:02AM
(#33800863)
Dry is mature and has additional support for Monads, thread safe containers, schemas. I'm leveraging more than just struct from Dry.
If I just need a bundle of attributes and don't care about immutability then I will continue to use Struct.
If I do need immutability I will continue to use dry-struct (https://dry-rb.org/gems/dry-struct/1.0/) which has much deeper guarantees of immutability and type enforcement.