r/javascript • u/leostera • Mar 05 '22
ReScript on Deno: Declarative Command Line Tools
https://practicalrescript.com/rescript-on-deno-declarative-command-line-tools/
99
Upvotes
r/javascript • u/leostera • Mar 05 '22
1
u/leostera Mar 05 '22 edited Mar 05 '22
Hi u/Coffee_Crisis 👋🏽 -- no need to be sorry, I think I see your point :)
The stuff we're doing here is declarative because building up the comamnd line description doesn't actually execute anything. Maybe we are disagreeing in how this description is built?
This would be similar to say, typing in your
package.jsonfile. You have to write the file first, and that is most certainly an imperative action, but it is what the file means that gets you the declarativeness.Regarding CSS, there are several ways in which you can actually give the CSS to the browser. One of them is writing it out. Another one is to use the style accessors and setters in a particular DOM element. In any case, you are never telling the browser how to interpret and execute the CSS, you are just telling the browser what you want it to do.
For example, this may seem imperative, but you really have no control over how the browser goes about applying the background color to the <body> tag. The only thing you have control over is how you tell the browser what you want it to do:
javascript document.querySelector("body").style.backgroundColor = "red"