3 ms·
I think this is a reasonable point, and your split() example is a good one. I wasn’t sure while I was writing the blog post if I considered isomorphisms to be p
by lexi-lambda 7y ago
I think this is a reasonable point, and your split() example is a good one. I wasn’t sure while I was writing the blog post if I considered isomorphisms to be parsers, and I’m still not entirely sure if I do or not, but there’s an argument to be made that they are simply parsers where the set of possible failures is empty. I don’t have strong feelings about that distinction one way or the other, though.
- tylerhou 7y agoSome other random feedback: the short phrase makes me think that I should parse instead of validating. Might I suggest: "Don't just validate: parse"?
- lexi-lambda 7y agoThe idea really is that parsing subsumes validation. If you’re parsing, you don’t have to validate, because validation is a natural side-effect of the parsing process. And indeed, I think that’s the very thesis of the blog post: parsing is validation, just without throwing away all the information you learned once you’ve finished!
- tylerhou 7y agoI understood the article, and I see your point, but my main feedback is that when I read the title I assumed that you were going to describe some way where you would parse input without validating it.
- erikpukinskis 7y agoFWIW, I don’t read that implication in the title.
- torstenvl 7y agoIf validation is necessarily included in parsing, then the title -- parse && !validate -- is impossible. The title of the post says "don't validate," and so I initially expected it to relate to the mantra of being liberal in what you accept, etc.
- erikpukinskis 7y agoOne thing to bear in mind is that headlines are not prose, they are shorthand. So you have to assume there could be missing words, since that’s how headlines work. In this case there is a dropped “just”: Don’t (just) validate: parse! If the headline was “Parse, never validate” then I would agree with your reading. But “don’t” is pretty lightweight. I’m having a hard time thinking of a lighter discouragement word. Given that, I think it’s unfair to assume the strongest discouragement is implied.
- skybrian 7y agoFurther nit-picking: even if there are no errors, I don't think it's an isomorphism unless the parser preserves all information? Usually parsers treat some input strings as equivalent (by stripping whitespace and comments), so there are fewer outputs than valid inputs. I can't think of an easy way to make string splitting an isomorphism in both directions. You can serialize any list of strings to a comma-separated list, but only if you use escape sequences or encode the length of each item, and then there are some input strings that are errors. I guess you could define a type as the set of all valid strings in the input language, but that's going out of your way to make sure parsing has to be done more than once. Parsers that report no errors don't seem desirable anyway; error-checking is usually good.
- papln 7y agoStructure is orthogonal to partiality. Partiality is what you get when you choose you only accept one branch of a disjunctive structure.