Immutable struct with getters
We can defined methods in the struct to become the getters of the attributes, but this too is boring.
struct Person def initialize(@name : String, @email : String) end def name @name end def email @email end end foo = Person.new("Foo", "firstname.lastname@example.org") p! foo p! foo.name p! foo.email
foo # => Person(@name="Foo", @email="email@example.com") foo.name # => "Foo" foo.email # => "firstname.lastname@example.org"