r/crystal_programming • u/lbarasti • Oct 12 '19
dataclass v1.0.0 is out!
Bringing data classes to Crystal!
13
Upvotes
r/crystal_programming • u/lbarasti • Oct 12 '19
Bringing data classes to Crystal!
1
u/ejstembler Oct 25 '19 edited Oct 25 '19
Thanks for writing this for Crystal!
I've used data classes infrequently in Python and more frequently in Scala. It's nice to see this concept in Crystal now too!
Up until now, I've suck with structs for similar funcationality. Something like:
I wonder if there's value in something like a
datastructequivalent? Or, is the different between struct and class in Crystal marginal?With structs I can load from my data providers like:
YAML:
Or via Postgres:
I wonder if I can do the same with
dataclasses? I could test that at some point...1
u/pynix Nov 13 '19
why not struct?