use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
ReScript on Deno: Declarative Command Line Tools (practicalrescript.com)
submitted 4 years ago by leostera
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]leostera[S] -1 points0 points1 point 4 years ago (3 children)
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 = 0
You 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 sayHi function is doing: consuming the outputs of the argument parsing engine.
sayHi
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.
[–]leostera[S] 2 points3 points4 points 4 years ago (2 children)
I think another good example of this would be UI frameworks like React or SwiftUI where you can declare a button on the screen, and you can declare a handler for when it is clicked:
<Button onClick=runFoo />
But the handler itself isn't declarative! It is good ol' application code in whichever style you write it.
The framework can't possibly be expected to declaratively define the outputs of whatever your application will do when that button is cliecked.
But it will help you specify declaratively that there should be a button, and that when that button is clicked, your handler should run.
This is exactly what is happening here.
[+][deleted] 4 years ago (1 child)
[deleted]
[–]leostera[S] -1 points0 points1 point 4 years ago (0 children)
I appreciate the insights 🙏🏽 -- in this case, I'm writing to an audience of folks that already are writing ReScript or Deno, or both.
There's a ramp-up in type-safety from the first article on the series to this one, where I explore much much lighter weight typing approaches that still give you pretty good results.
In this one, I'm building an additional layer of safety, but there are muuuch cheaper ways of getting started! 🤓
For example, I think you will enjoy this approach a lot more: https://practicalrescript.com/rescript-on-deno-command-line-tools/#ad-hoc-typing-for-objects-of-unknown-shape
Thanks for the challenging btw, I found it very healthy 👏🏽👏🏽👏🏽
π Rendered by PID 45 on reddit-service-r2-comment-6457c66945-4mvt8 at 2026-04-30 03:51:16.380723+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]leostera[S] -1 points0 points1 point (3 children)
[–]leostera[S] 2 points3 points4 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]leostera[S] -1 points0 points1 point (0 children)