3 ms·
SQL does not make sense as a declarative language to me. How you can say that SQL and HTML is the same by nature? Also I can't see why we can't argue about this
by spamtarget 4y ago
SQL does not make sense as a declarative language to me. How you can say that SQL and HTML is the same by nature? Also I can't see why we can't argue about this against the literature. Saying "you are wrong because 20 years old textbook say you are wrong" is not an argument for me
- indymike 4y ago"Declarative language" does not mean "free of computation". It does mean the language generally specifies an output. HTML does have computation in the form of <script> tags. What makes HTML and SQL declarative instead of imperative is that in both SQL and HTML the document specifies an specific output that is wanted from the browser (in HTMLs case) or database (in SQLs case). Your earlier example of SELECT (1+3); is something that can be done in HTML (many different ways), too. Reality is that declarative languages would be little more than file formats without access to computation. For example, it would be impossible to write a query that always returned results for the interval of last week, without having to change the query every time you run it without the now and interval commands.
- spamtarget 4y agoI never meant "free of computation", I actually mentioned a lot that forget computers and softwares, and focus on languages. <script> is Javascript, not html (I mean what's inside), they just smashed together. >specifies an specific output That specific output definition is really different. Consider this: -task: give me even numbers -imperative approach: for i=1 to 100 result += i * 2 next -functional approach return [1,2,3,...].select(x=x * 2) -declarative approach (not possible, but for the sake of example) EVEN NUMBERS = NUMBERS LIKE 2,4,6 AND CARRY ON <-this requires a framework, which understand every word i wrote there. What i wanna ask you to re-explain these examples with your understanding of classification, but using the same task. >Reality is that declarative languages would be little more than file formats without access to computation. That what HTML is. A declarative language and a file which requires a framework. > Your earlier example of SELECT (1+3); is something that can be done in HTML (many different ways), too. No, not with strictly sticking to the standard and not use any trickery. HTML was not designed to do any kind of calculation. That's why javascript came later.
- indymike 4y ago> No, not with strictly sticking to the standard and not use any trickery. HTML was not designed to do any kind of calculation. That's why javascript came later. I thought you would go here, and I understand where you are coming from: Declarative language != file format and declarative is not a paradigm like functional, procedural, object-oriented. Every useful declarative language allows for some level of computation. Take a template language - YAML + some template tags. Aside allowing variable substitution, every time, the language grows a way to make those substitutions more useful, so you get things like: {{ variable_containing_a_date + interval(days=1) }} Back to functional, oo, procedural: some declarative languages import a paradigm. Back to the script tag: Even though it was added after the original spec, <script> is part of the standard for HTML and is one of the reasons it pushed many other formats to the side and the web won. I would submit that HTML+JavaScript is the platform, not just HMTL. One can write declarative code in an imperative language, and the reverse is true. I do really appreciate you thinking on this, but I think we're best to use the existing definition and example of declarative languages, and not just banish declarative to static file formats.
- indymike 4y agoFurther, another way to look at it is, declarative languages specify output, imperative languages focus on the steps to generate outputs. In imperative code, I'm worrying about how instead of what. In declarative code, I'm worried about what instead of how. As in all things, neither of these statements will be absolutes - there are situations and times where a declarative language user will worry about how the query planner will execute, and there are times where an imperative language user will write very much declarative code.
- spamtarget 4y ago>neither of these statements will be absolutes - there are situations and times where a declarative language user will worry about how the query planner will execute, and there are times where an imperative language user will write very much declarative code. That's right, in practice everything is more like a mishmash of everything. Your function library could be seen as a declarative language over the top of a generic language.
- indymike 4y ago> That's right, in practice everything is more like a mishmash of everything. I agree, and will die on this hill :-)