7 ms·
Maybe, maybe not. Data classes are meant to feel like Scala's case classes, or Haskell's record syntax. The point is to stop passing around dicts/hashmaps/tabl
by nerdponx 6y ago
Maybe, maybe not. Data classes are meant to feel like Scala's case classes, or Haskell's record syntax.
The point is to stop passing around dicts/hashmaps/tables and tuples, and to start passing around containers with a known and fixed set of keys/names, and known types for the values/elements.
I don't know of any language where the compiler automatically infers field names and types, and I don't know if I would ever want such a thing.
- josteink 6y ago> I don't know of any language where the compiler automatically infers field names and types, and I don't know if I would ever want such a thing. Typescript can do this to unannotated code, and it’s surprisingly useful.
- nerdponx 6y agoI've already started checking out Typescript as a general-purpose scripting language to replace Python, Ruby, Perl, and to some extent Bash/Zsh. Knowing this makes it even more attractive. The only annoyances I've had so far are: difficult-to-search docs, and the `tsc` command-line compiler is slow.