Stop writing CLI validation. Parse it right the first time
1–10 of 169 posts
Re: Stop writing CLI validation. Parse it right the first time
#2But this is wrong. Programmers should be writing parsers all the time!
Re: Stop writing CLI validation. Parse it right the first time
#3This project looks neat, I've never thought to use parser combinators for something other than left-to-right string/token stream parsing.
And I like how it uses Typescript's metaprogramming to generate types from the parser code. I think that would be much harder (or impossible) in other languages, making the idiomatic design of a similar similar library very different.
Re: Stop writing CLI validation. Parse it right the first time
#4Re: Stop writing CLI validation. Parse it right the first time
#5Re: Stop writing CLI validation. Parse it right the first time
#6Stopped reading after realising this is written by ChatGPT
Re: Stop writing CLI validation. Parse it right the first time
#7Stopped reading after realising this is written by ChatGPT
Re: Stop writing CLI validation. Parse it right the first time
#8I've noticed that many programmers believe that parsing is some niche thing that the average programmer likely won't need to contend with, and that it's only applicable in a few specific low-level cases, in which you'll need to reach for a parser combinator library, etc . But this is wrong. Programmers should be writing parsers all the time!
Don't get me wrong, I actually love writing parsers. It's just not required all that often in my day-to-day work. 99% of the time when I need to write a parser myself it's for and Advent of Code problem, usually I just import whatever JSON or YAML parser is provided for the platform and go from there.
Re: Stop writing CLI validation. Parse it right the first time
#9Isn’t writing code and using zod the same thing? The difference being who wrote the code.
Of course, you hope zod is robust, tested, supported, extensible, and has docs so you can understand how to express your domain in terms it can help you with. And you hope you don’t have to spend too much time migrating as zod’s api changes.
Re: Stop writing CLI validation. Parse it right the first time
#10I've noticed that many programmers believe that parsing is some niche thing that the average programmer likely won't need to contend with, and that it's only applicable in a few specific low-level cases, in which you'll need to reach for a parser combinator library, etc . But this is wrong. Programmers should be writing parsers all the time!
Last week my primary task was writing a github action that needed to log in to Heroku and push the current code on main and development branches to the production and staging environments respectively. The week before that, I wrote some code to make sure the type the object was included in the filters passed to an API call. Don't get me wrong, I actually love writing parsers. It's just not required all that often in…