3 ms·
Honestly they could have made Struct simply be a hash with some syntactic sugar, I can't say I've ever used Struct in anything I've written in my 8+ years writi
by pdntspa 4y ago
Honestly they could have made Struct simply be a hash with some syntactic sugar, I can't say I've ever used Struct in anything I've written in my 8+ years writing Ruby professionally
With this new data class... Idunno I'm shrugging my shoulders. The whole mutability/immutability debate has always seemed so pointless. Don't go assigning shit so willy-nilly?
- deleted 4y ago[deleted]
- kayodelycaon 4y agoI use Struct for some things because it enforces and documents the shape of the data. This is especially helpful when code gets complicated and you have a lot of hashes being thrown around. Instead of trying to document and enforce a nested hash structure through multiple layers, you can use Structs to make mini classes that do that for you.