4 ms·
> I think that moto doesn't fit Dart at all, I use Dart and I have to make some workarounds that I just shouldn't be doing, but I have to because the language d
by DCKing 12y ago
> I think that moto doesn't fit Dart at all, I use Dart and I have to make some workarounds that I just shouldn't be doing, but I have to because the language doesn't have the functionality that other languajes already have.
Could that be explained because of not used to type safe languages? Type safe languages have a well-known clunkiness to dynamic type creation as well as other things. You get correctness in return, which is often worth it. It is also precisely the point of Dart's type system.
> In this case, I would be easy for them to add JSON serialization to objects, you know, but they didn't, why? polictics, apathy, whatever, but not technical problems.
This assertion is simply false. Adding arbitrary object creation support to a mostly statically typed language is not trivial at all [1]. What's more is that adding it will only give the guise of type safety when it's really not there.
[1]: See Jackson's source code, a popular Java (de)serialization library: https://github.com/FasterXML/jackson-core https://github.com/FasterXML/jackson-core
- adrianlmm 12y ago>Could that be explained because of not used to type safe languages? Is not about type safe, Dart can be used as both, a type safe lenguage and as a dynamic lenguage, demanding to cover a certain part of of what a type safe language has it is reasonable, now, if the package was to big for Dart designers they should have made Dart a dynamic language only. > This assertion is simply false. Is not that false, anyone can do a JSON to bject parser, the problem I see is that they would need to include mirrors as default to give such functonality, but when exported to JavaScript mirrors would make the exported file to be huge, so I see this as a way to mitigate the desing problems Dart it self has. As I said, they need to put first in the user shoes and see what is convenient to them and then work in the desing, but I get the impression that they desingned Dart to be fast, it doesn't matter if some desitions affect the developers, the priority is make it fast and not handy for developers.
- DCKing 12y ago> Is not about type safe, Dart can be used as both, a type safe lenguage and as a dynamic lenguage, demanding to cover a certain part of of what a type safe language has it is reasonable, now, if the package was to big for Dart designers they should have made Dart a dynamic language only. If the goal is not to make it type safe, then there is really no objection to just use the built-in Map+List JSON parser, is there? > I see this as a way to mitigate the desing problems Dart it self has. How could a language a language possess both classes and not spend a lot of complexity trying to shoehorn JSON objects to fill the data in those classes? This is not a problem of Dart, this is a problem of class-based object orientation. It baffles me that people expect it to arbitrarily map JSON to those classes when the associated complexity is well-known.
- adrianlmm 12y ago>If the goal is not to make it type safe, then there is really no objection to just use the built-in Map+List JSON parser, is there? A Map is not type safe, at least, not the default result of a JSON.decode in Dart, actually, the result is a dynamic Map. I don't know what your point is. >This is not a problem of Dart, this is a problem of class-based object orientation It is not a problem, it is a must have. The associated "complexity" was overcome many years ago with Generics (or templates), Dart has this, so, there is no excuse.
- DCKing 12y ago> A Map is not type safe, at least, not the default result of a JSON.decode in Dart, actually, the result is a dynamic Map. I don't know what your point is. A dynamic type does not give you type safety, and neither does a dynamic Map. A dynamic type might give you a little more type safety than a map, but invalid member access would give you as much headache in both situations. So why even bother dragging in so much complexity for this when you can just write your own code? > It is not a problem, it is a must have. You say that as if it's a fact. Have I not put enough on the table to demonstrate that what you're saying is 1) an opinion 2) a minority opinion 3) is ignorant of the associated complexities 4) demonstrably not necessary for web applications? > The associated "complexity" was overcome many years ago with Generics (or templates), Dart has this, so, there is no excuse. Please explain how generics helps in overcoming this complexity. I'm genuinely interested.
- adrianlmm 12y agoPlease before I can answer you, tell me what is that mythical "complexity" in doing it first, because, we haven't stablished what is it, what is actually the problem? >is ignorant of the associated complexities Tell me what complexities?
- DCKing 12y agoLook at how much code Jackson uses for their core serialization: https://github.com/FasterXML/jackson-core https://github.com/FasterXML/jackson-core . This is a (the?) .NET library for the same: https://github.com/JamesNK/Newtonsoft.Json/tree/master/Src/Newtonsoft.Json https://github.com/JamesNK/Newtonsoft.Json/tree/master/Src/N... That's a lot of code, don't you think? Quite a bit of work to write it. Quite a bit of edge cases to cover. It's fine to include this in your compiled distributed server or client application. But it's quite a problem if it needs to be loaded in the browser. You could argue that a simpler, less complete implementation is in order. But what language developer would want to include an API that is known to be incomplete and therefore fragile? This seems to be a job for an external library. I'm still trying to find another statically typed class based compile-to-JS language that does deserialization like proposed, but I still can't seem to find it. Could it be unwillingness like you suggested? Seems unlikely to me as it does seem quite useful for some quick and dirty applications at the very least. Or maybe could it be that satisfactory implementations could not be made?