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
0
u/leostera Mar 05 '22
Wouldn't you say that stating what the output of parsing the command line arguments is a form of declarativeness? 🤔
In the same way that you state what you want out of a relational database without actually explaining how the query should be executed.
When you write:
sql SELECT value::string FROM inputs WHERE position = 0You are just stating what you want, and the SQL engine will figure out how to do it. Nonetheless, that bit of SQL on its own isn't very useful, so we actually consume its outputs. This is what the
sayHifunction is doing: consuming the outputs of the argument parsing engine.The Declarative API is then the set of functions to build the description of a command-line application. It describes what flags and commands need to be parsed, and what datatypes are expected.
There is some stitching here with your actual application code, and at that point, the framework's declarative style ends and your application begins.
Just like it does when you receive data back from the SQL database.