2 ms·
> I never said I didn't want it there; I said I didn't put it there. You can't tell me I have no right to put something on the homepage when it ended up there b
by DCKing 12y ago
> I never said I didn't want it there; I said I didn't put it there. You can't tell me I have no right to put something on the homepage when it ended up there because of HN's algorithm (which suggests that others did want it there).
Don't confuse the argument. If you wanted it on the front page then you wanted to drag your entitlement beyond the original discussion onto the HN front page. You have many rights to do all sorts of things, but exercising it in this case just makes you seem entitled to me.
> This is nothing to do with using a web service as an ORM, this is how web apps work - code runs in your browser, and needs to communicate with a server where I can retrieve or persist things. How do you think Gmail marks an email as Read when you open it? Fetches your email? etc.
Don't strawman my argument. 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?
> This is nonsense. Pulling data from a server into a Map is bug-prone, because if you use it as a map, all of your code can be wrong. If it's converted to a type, then only the mapping can be wrong, and the rest of the code can have static analysis.
Maps have no pretense of type safety. Manual mappings have actual type safety. Reflection based automated mappings only have the pretense of type safety with a whole lot of problems.
I'm not saying reflection based mappings don't have merits. They do. But in a context where mapping-to-classes is not shown to be a necessity ("99% of all webapps" don't do that) and where there are plenty of alternatives, you are blowing up the problem.
> This is one of the selling points of Dart, and it's totally stupid to throw it away.
Except for the fact you're not really arguing for real type safety, I do agree. It is a missed opportunity in the Dart ecosystem. Does that really equate to Dart missing basic functionality? I think it just shows that it would be nice if there was a library for that. In the meantime, there are plenty of other things you can use.
- 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.