Sujet : Re: Command Languages Versus Programming Languages
De : mortonspam (at) *nospam* gmail.com (Ed Morton)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 20. Nov 2024, 12:46:49
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vhki79$2pho$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Mozilla Thunderbird
On 11/20/2024 2:21 AM,
Muttley@DastartdlyHQ.org wrote:
On Tue, 19 Nov 2024 18:43:48 -0800
merlyn@stonehenge.com (Randal L. Schwartz) boring babbled:
"Lawrence" == Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
Lawrence> Perl was the language that made regular expressions
Lawrence> sexy. Because it made them easy to use.
>
I'm often reminded of this as I've been coding very little in Perl these
days, and a lot more in languages like Dart, where the regex feels like
a clumsy bolt-on rather than a proper first-class citizen.
Regex itself is clumsy beyond simple search and replace patterns. A lot of
stuff I've seen done in regex would have better done procedurally at the
expense of slightly more code but a LOT more readability.
Definitely. The most relevant statement about regexps is this:
> Some people, when confronted with a problem, think "I know, I'll use
> regular expressions." Now they have two problems.
attributed to Jamie Zawinski, see
https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/.
Obviously regexps are very useful and commonplace but if you find you have to use some online site or other tools to help you write/understand one or just generally need more than a couple of minutes to write/understand it then it's time to back off and figure out a better way to write your code for the sake of whoever has to read it 6 months later (and usually for robustness too as it's hard to be sure all rainy day cases are handled correctly in a lengthy and/or complicated regexp).
Ed.