Struct no more? ::Data has arrived in Ruby. A more modern take on "value objects". Person = Data.define(:first_name, :last_name) me = Person.new(first_name: "Jared", last_name: "White") Works with pattern matching! Details & docs here: github.com/ruby/ruby/pull…
3
36
132
0
15
The obvious difference from Struct is that Data is immutable (aka no reassignment of member variables). You initialize with data, and then that's it. So perhaps we still need Struct after all, but Data is compelling for many use cases!
@fullstack_ruby Immutable object would be very useful in multi threads env or in fiber heavy env
@fullstack_ruby what does this mean for @dry_rb's Dry::Struct?