4 ms·
Erring on the side of more restrictive works only if you can later relax the restriction without too much rework. In the author's regex example, if you use a re
by kartickv 11y ago
Erring on the side of more restrictive works only if you can later relax the restriction without too much rework. In the author's regex example, if you use a regex subset and later realise that you need the full power of regexes, you can relatively easily switch to a full-fledged parser. But if you choose a simple programming language and later realise that you need a more powerful one, you have to rewrite all your code.
Ideally, languages would be scalable so that you can easily flip the "more power" switch without rewriting everything. One way of achieving a scalable language is to consciously design it as a subset or a superset of an existing, widely used language, as with a safe regex parser vs a full regex parser. Another way of achieving scalability is a language that supports the more powerful features, but with a clear barrier that you have to consciously cross, as with reflection in Java (as opposed to making everything dynamically typed).
Absent a scalable language, erring on the side of being more restrictive runs the risk of a lot of rework later on.