logoalt Hacker News

crazygringo • yesterday at 11:13 PM • 0 replies • view on HN

The point is, if you don't use regex that frequently, you can completely forget that ^ means start and $ means end. And adding those as line comments ("^ # Start of expression") would be dumb.

That's why a well-designed DSL tries to make its syntax as self-explanatory as possible. Using "start" instead of "^", or "digit" instead of "d".

We're not doing equations here, we're doing engineering. Analogies to proofs are not helpful. There is a very good reason why, in coding, we give descriptive variable names such as "accountBalance" rather than "b".

Conciseness is not a virtue in programming. Clarity is. Things should not be longer than they need to be -- but neither should they be shorter. The name of something should not be 100 characters long, but neither should it be 1 character long. A word or two is generally the sweet spot.