3 ms·
I'm a huge fan of Dart and very happy to see this. I haven't been able to use it in any non-hobby projects yet, but I love that Dart compiles to JavaScript on t
by nozzlegear 9y ago
I'm a huge fan of Dart and very happy to see this. I haven't been able to use it in any non-hobby projects yet, but I love that Dart compiles to JavaScript on the frontend and runs in a VM without any compilation on the server. A good programming language that works on both the server and the browser is like my "holy grail" of programming.
However, there's one thing keeping me from using Dart more professionally, and that's how surprisingly difficult it is to work with JSON out of the box. For a language that compiles to JS I would expect JSON interop to be as easy as "Json.Serialize" and "Json.Deserialize", but instead you need to fiddle with mirrors, add properties and metadata to classes, extend other classes, monkey around with maps and keys, add build steps, etc. This is a big showstopper when you work with web apps, and I'm slightly disappointed to not read any improvements on this front in Dart 2.0, unless I've missed something.
(Shameless plug, I wrote a very brief summary of my thoughts on Dart -- 1.2, not 2.0 -- after trying it for the first time: https://nozzlegear.com/blog/quick-thoughts-on-the-dart-language https://nozzlegear.com/blog/quick-thoughts-on-the-dart-langu... )
- munificent 9y ago> However, there's one thing keeping me from using Dart more professionally, and that's how surprisingly difficult it is to work with JSON out of the box. We've talked about this a lot on the team. We definitely know it's a problem but so far we haven't had enough bandwidth to devote anyone to really digging in and addressing it. (It turns out that redesigning a type system and re-implementing the entire front end takes a lot of work...) Hopefully once things settle down after Dart 2 we can take another look at this.
- nozzlegear 9y agoGood to hear it's on your radar, and I certainly don't mean to trivialize how much work is involved in making Json work more smoothly with Dart's type system. I'm looking forward to any improvements that might come down the road after Dart 2!
- kevmoo1 9y agoIn some cases, there is a trivial one-to-one mapping between a Javascript object and it's JSON serialization. This is not the case in Dart for a number of reasons. Many folks are happy with the solution we have – here's an example: https://github.com/dart-lang/json_serializable/tree/master/example https://github.com/dart-lang/json_serializable/tree/master/e... We're certainly interested in making this better in the future, but as Bob said (https://news.ycombinator.com/item?id=16441665 https://news.ycombinator.com/item?id=16441665) we're very focused on finishing Dart 2 first.
- nozzlegear 9y agoThanks for the link, I remember stumbling on this at some point but don't remember why I didn't use it; I'll give this solution another shot! And like I said above, I don't mean to trivialize how much work would be involved in making Json work better with Dart. I'd love to use this language in my day-to-day work, but the Json story has been the only blocker there.
- markdog12 9y agoAnother huge Dart fan here. While I love Dart, my complaint is exactly the same as yours, JSON serialization/deserialization. I don't want to think about all the hours I've lost researching various 3rd party packages which didn't meet my needs. In my opinion, it's so important, first-class support should've been done right out of the gate. Edit: There was a repo for ideas to address this: https://github.com/matanlurey/dart_serialize_proposal https://github.com/matanlurey/dart_serialize_proposal No activity for quite a while