4 ms·
> If you wanted it on the front page then you wanted to drag your entitlement beyond the original discussion onto the HN front page I wanted it to be noticed,
by d2p 12y ago
> If you wanted it on the front page then you wanted to drag your entitlement beyond the original discussion onto the HN front page
I wanted it to be noticed, in the hope of getting an "official" response from someone that knows why we don' have it (or whether we'll ever get it). If you don't like that it's on the homepage; you can't blame me for that; the algorithm is based on HN users, not you.
> You need data client side, why is it necessary that they need to take the specific form of your own custom Dart classes mapping exactly to the shape of your JSON?
How is that at all what I'm asking for? I'm asking for to get data from a Dart class out of dart (via a string; I don't care if it's JSON), and then back in. This is a pretty basic need. I want the over-the-wire format to be documented so that I can use non-Dart on the server is required, and to avoid versioning issues. This seems like a pretty basic need for a web app?
> Reflection based automated mappings only have the pretense of type safety with a whole lot of problems
Rubbish. You can crash if the string doesn't deserialise exactly as expected; but then you get strong guarantees about the rest of your codebase that uses these types. Manual mapping is not a viable solution for any reasonable sized application.
> But in a context where mapping-to-classes is not shown to be a necessity ("99% of all webapps" don't do that)
That's garbage; it's not done now, because there's no ability to do that. One of the selling points of Dart is having typing; nobody would turn this down if it was easy and possible.
> and where there are plenty of alternatives, you are blowing up the problem.
All of the suggestion options have been criticised in the thread. Mirror-based is apparently no good for dart2js production code; protobuffers plugin doesn't work on Windows; and everything else needs manual mappings.
> It is a missed opportunity in the Dart ecosystem. Does that really equate to Dart missing basic functionality?
In my opinion; yes. Everyone is sending data back and forth to a server; they shouldn't need to write custom mapping code just to package it into a schema that gives type checking and code-completion.
- DCKing 12y ago> That's garbage; it's not done now, because there's no ability to do that. One of the selling points of Dart is having typing; nobody would turn this down if it was easy and possible. You assert that Dart has, in principle, the ability to do that. But it doesn't. Not in the general case. No class-based programming language can solve this problem in general. You can have a close-to-complete solution (like C# and Java do), but that complexity is very unwanted for a language running in the browser. Adding a language feature to Dart does not solve this problem either. Fitting dynamic data such as JSON or some other interchange format into a compiled definition in a typesafe way is just very hard. Writing validating mapping code really is the most robust thing to do. So you end up with a fragile solution of large complexity. Or you can just write the mapping code yourself if you really really need it. > Rubbish. You can crash if the string doesn't deserialise exactly as expected; I'm going to use your own quote here: this "is not a viable solution for any reasonable sized application". Dart is made for large projects where type safety guarantees imply your project has a certain degree of correctness. If you want to undermine that by introducing crashes on bad mappings, then you have to do it yourself. > Manual mapping is not a viable solution for any reasonable sized application. There are plenty of "viable" projects out there with manual mapping of reasonable size. It's understandable that you don't feel particularly excited about writing that code. But don't blame that on the Dart developers. No other class based+statically typed+compile-to-JS language has the feature you desire, and I'm trying to tell you why.