Live data from Hacker News

Why Dart should learn JSON while it’s still young

maxhorstmann.net

51–55 of 55 posts

Re: Why Dart should learn JSON while it’s still young

#52
post #44

Earlier quoted context omitted.

- huge js file size (2MB+ easily) - obscure hard to use js interop facilities - very slow js interop - broken js minification (ignored tickets) - no older browser support - ridiculously long compile times I honestly welcome anyone who uses dart in a production environment to link to a blog post or explain how they worked around these, because we found they made using dart2js such a nightmare we gave up on it. I speak…

> (amusingly, from your link: 'Does not work in Firefox (neither Stable nor Nightly), but works in Chrome Dev and Safari.') It's most likely problem with polyfills, not with dart2js compilation problem, I have not tried to debug it yet.

Fixed. It was purely my bug: I was relying on a certain ordering of propChanged() callbacks, but it does not seem like Polymer.dart guarantees any.

Now it works in Chrome/FF/Safari all the same.

Re: Why Dart should learn JSON while it’s still young

#53

I was the TL of the libraries for almost a year, and there are good reasons we didn't go this route: - it adds overhead. Being able to write JSON.encode(customer) would mean that every class needs to retain its field names. Minification could still work if this information is stored on the side, but it would add overhead. - it doesn't make sense to automatically encode elements that cannot be decoded. You should have…

I certainly agree with the latter point if adding a default/out of the box JSON serialization does indeed add significant overhead, impacting all users including those which don’t require it. On the flipside, if a cost-effective solution can be found – e.g. by providing a default JSON serialization via class annotations – I feel that it should be part of Dart’s core and not up to individual developers to home-brew their own solution to a very common problem. In the particular case of DateTime, I’m pretty sure that adding a default JSON serialization now will increase interoperability between Dart-based services and sites in the future.

Re: Why Dart should learn JSON while it’s still young

#55
post #15

Earlier quoted context omitted.

Can you talk more about your experience with GWT-RPC?

GWT-RPC was designed before I got there, but the basic idea was to make it work just like Java serialization. To do this, you need to calculate at compile time which types the client might possibly have to deserialize and include client-side code to instantiate those types. But we don't want to do this for every Serializable type because of code bloat; when a type is declared Serializable in Java it's often intended…

Just remembered this thread and came back. Thanks for the insight.
Post reply on HN