3 ms·
How do you think code that parses XML makes the UI elements?
by nikki93 9y ago
How do you think code that parses XML makes the UI elements?
- zbentley 9y agoBy that logic, should we all write assembly on the server side? Declarative, high-level structures (like UI definitions in XML or some other data-only format) really do change the paradigm. You can argue that it's not a useful change, but saying "it's all parsed by imperative logic at some point!" is specious.
- nikki93 9y agoThe point is that a Dart library can write a parser for XML, but if XML was the only supported format, it's hard to go in the other direction. Also if you read example Flutter code, you may notice that their UI spec DSL-like is 'declarative'. In terms of a 'change' as you point out, change is a comparison between two points, and when you compare XML to this declarative paradigm, the main difference isn't along the declarative-or-not axis (because they are similar in that regard), but things like programmability (often with 'templates' in XML) or parseability, in which case in-language DSL-likes work really well (you can write, for example, a lambda returning a UI fragment that closes over some parameters, or you can `.map(...)` a UI fragment over a `List`, ...). The change you may be pointing at is against maybe original GTK-like or Android-Java-like imperative constructs, but this discussion is about a Flutter-XML comparison. Of course, in the Flutter case, the DSL-like is actually just function calls and doesn't involve macros or a separate code generation step.