6 ms·
Small languages, if they are suitably constrained, offer far more reasoning power and optimisation potential. This is why we need more small languages, not less
by grumpyprole 2y ago
Small languages, if they are suitably constrained, offer far more reasoning power and optimisation potential. This is why we need more small languages, not less. Python aims for maximum flexibility and maximum ease of use. This comes with real and serious trade offs. Python programs are very very difficult to reason about, for both people and machines.
A textbook example for you are (proper) regular expressions. This little language guarantees O(n) matching. The Python and Perl communities added backtracking without truly understanding why backtracking was missing in the first place. Now their misnamed "regular expressions" cause security issues for their users.
- AlotOfReading 2y agoEven Thompson didn't use the linear time algorithm that's named after him in Ed and Grep. The Python and Perl implementations were inspired by Henry Spencer's regex, which was in turn reimplementing Thompson's backtracking implementations.
- grumpyprole 2y agoAre you sure it was Thompson who added backtracking to grep? Note also that the POSIX standard intentionally omits backtracking regex. It is a shame that others have not deprecated them.
- AlotOfReading 2y agoWe're talking about backtracking and not back references, right? The original implementations of Ed and Grep in Unix did backtracking, not back references.
- grumpyprole 2y agoOops I mean't back references, since that is the problem feature (that requires backtracking).