|
|
|
|
|
by trips2
5041 days ago
|
|
This is like trying to tell people to stop typing cat file|program1|program2
instead of program1 file|program2
It is futile. There are so many examples of programmers just doing mindlessly stupid things, often because "everyone else is doing it" or they read some "howto" they found somewhere, or they are using some library written by someone else.How many times do you think people use extended regular expressions and backtracking when it's entirely unnecessary? They often have no idea that there is even a simpler way that will work (in some cases it might be faster). They think more complexity is actually making things "easier". Must have PCRE. Why? "Because I can't get basic regex to do what I want." Let 'em enjoy their complex regex. Until there's a problem and they have to try to decipher what they heck it's actually doing. PEG is fine. Lua has a good PEG library. Still, a good handle on basic regex will take you a long way. |
|
It's also easier to change the first command in the pipeline without having to step over the input argument, again more consistent with the rest of the pipeline.
To avoid the cat, one can write
but in practice, cat adds no noticeable overhead.As for regexes, I personally find using POSIX regular expressions to be a bit like using vi after becoming familiar with vim. You can get by, but it's crap and there's a reason why people came up with something better. Of course, using complicated features of any language or toolkit without understanding how they work is dumb, but that's not a reason to go back to the 1980s.