Deutsch   English   Français   Italiano  
<vhkh94$2oi3$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 11:30:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <vhkh94$2oi3$1@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org>
 <0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk>
 <uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me>
 <87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com>
 <ve83q2$33dfe$1@dont-email.me> <vgsbrv$sko5$1@dont-email.me>
 <vgtslt$16754$1@dont-email.me> <86frnmmxp7.fsf@red.stonehenge.com>
 <vhk65t$o5i$1@dont-email.me>
 <vhkev7$29sc$1@dont-email.me>
Injection-Date: Wed, 20 Nov 2024 12:30:44 +0100 (CET)
Injection-Info: dont-email.me; posting-host="36fbe858f1cae8ac98599318d5cdf800";
	logging-data="90691"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18Nbp0oaNNoz5S3Bduf1PwN"
Cancel-Lock: sha1:ez4z3rrylpx24SOojjsVet3IR+M=
Bytes: 3391

On Wed, 20 Nov 2024 11:51:11 +0100
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> boring babbled:
>On 20.11.2024 09:21, Muttley@DastartdlyHQ.org wrote:
>> On Tue, 19 Nov 2024 18:43:48 -0800
>> merlyn@stonehenge.com (Randal L. Schwartz) boring babbled:
>>>
>>> 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. Also given its
>> effectively a compact language with its own grammar and syntax IMO it should
>> not be the core part of any language as it can lead to a syntatic mess,
>which 
>> is what often happens with Perl.
>
>I wouldn't look at it that way. I've seen Regexps as part of languages
>usually in well defined syntactical contexts. For example, like strings
>are enclosed in "...", Regexps could be seen within /.../ delimiters.
>GNU Awk (in recent versions) went towards first class "strongly typed"
>Regexps which are then denoted by the @/.../ syntax.
>
>I'm curious what you mean by Regexps presented in a "procedural" form.
>Can you give some examples?

Anything that can be done in regex can obviously also be done procedurally.
At the point regex expression become unwieldy - usually when substitution
variables raise their heads - I prefer procedural code as its also often 
easier to debug.

>In practice, given that a Regexp conforms to a FSA, any Regexp can be
>precompiled and used multiple times. The thing I had used in Java - it

Precompiled regex is no more efficient than precompiled anything , its all
just assembler at the bottom.

>then operate on that same object. (Since there's still typical Regexp
>syntax involved I suppose that is not what you meant by "procedural"?)

If you don't know the different between declarative syntax like regex and
procedural syntax then there's not much point continuing this discussion.