Hacker News new | past | comments | ask | show | jobs | submit login

The lack of easy serialization is pretty strange. Even on stodgy old non-dynamic versions of C#, YamlDotNet does a really good job of translating arbitrary objects to and from YAML/JSON just using reflection.



Server-side languages have it easy. Code size isn't much of an issue so reflection works fine.

In a browser where code size matters, there are two ways to go:

1) In JavaScript, every library author needs to figure out how to crunch their library as much as possible and library authors brag about their small code size and minimal dependencies. We have debates about whether JQuery is worth it.

2) You implement tree-shaking so you only pay for the functions you use (GWT, Dart, and the Closure compiler's advanced mode). But tree-shaking doesn't play well with reflection, which is why dart2js reflection is a work in progress.

You can also go with code generation (essentially compile-time reflection) but that also increases compile times and adds code bloat due to the generated code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: