←back to thread

Parse, Don't Validate (2019)

(lexi-lambda.github.io)
389 points melse | 1 comments | | HN request time: 0.209s | source
Show context
bruce343434 ◴[] No.27640435[source]
This still sounds like validation but with extra steps. (or less?)
replies(3): >>27640629 #>>27640647 #>>27642145 #
plesiv ◴[] No.27640629[source]
The post is saying:

- don't drop the info gathered from checks while validating, but keep track of it

- if you do this, you'll effectively be parsing

- parsing is more powerful that validating

"Extra steps" would be keeping track of info gathered from checks.

replies(1): >>27641503 #
bruce343434 ◴[] No.27641503[source]
Right. My takeaway was "verify and validate once, then put it in a specially marked datastructure, or if your language allow it make the typesystem guarantee some conditions of the data, then work with that from there". Where does parsing come in the picture?
replies(3): >>27642118 #>>27642191 #>>27642202 #
1. vvillena ◴[] No.27642118[source]
Well, ain't that it? If you validate a string so that it contains some angle bracket tags at the beginning and the end, ensure that both the tag values contain the same string (except for one extra marker in the end tag), and store the tag name and the string within the tags in a purpose-made data structure, you can call it whatever you want. Some will call that a rudimentary XML parser.