Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #435: Internet shut down due to maintenance


comp / comp.unix.shell / Re: Command Languages Versus Programming Languages

SubjectAuthor
* Re: Command Languages Versus Programming LanguagesBozo User
+* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
|`* Re: Command Languages Versus Programming Languagesusuario
| `* Re: Command Languages Versus Programming LanguagesMuttley
|  `* Re: Command Languages Versus Programming Languagesusuario
|   `- Re: Command Languages Versus Programming LanguagesMuttley
`* Re: Command Languages Versus Programming LanguagesRainer Weikusat
 `* Re: Command Languages Versus Programming LanguagesMuttley
  +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |+* Re: Command Languages Versus Programming LanguagesMuttley
  ||+* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |||+* Re: Command Languages Versus Programming LanguagesKaz Kylheku
  ||||`* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |||| `* Re: Command Languages Versus Programming LanguagesBart
  ||||  `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||   `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    +* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |+* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    ||+* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||`* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    ||| `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||  `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||   +* Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    |||   |`- Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||   `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||    `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     +* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |+* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||+* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |||`* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||| +* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     ||| |`* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||| | `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     ||| |  `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||| |   `* Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    |||     ||| |    `- Re: Command Languages Versus Programming LanguagesDavid Brown
  ||||    |||     ||| `- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||    |||     ||`- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||    |||     |`* Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    |||     | `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |  `* Re: Command Languages Versus Programming LanguagesBart
  ||||    |||     |   `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |    `* Re: Command Languages Versus Programming LanguagesBart
  ||||    |||     |     `- Re: On overly rigid definitions (was Re: Command Languages Versus Programming LaDan Cross
  ||||    |||     `- Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    ||`* Re: Command Languages Versus Programming LanguagesKaz Kylheku
  ||||    || +- Re: Command Languages Versus Programming LanguagesBart
  ||||    || `- Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |`- Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||    |`- Re: Command Languages Versus Programming LanguagesMuttley
  ||||    `* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||     `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||      +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||      |+* Re: Command Languages Versus Programming LanguagesChristian Weisgerber
  ||||      ||+- Re: Command Languages Versus Programming LanguagesMuttley
  ||||      ||`- Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||      |`- Re: Command Languages Versus Programming LanguagesBart
  ||||      `* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||       `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||        `- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  |||+* Re: Command Languages Versus Programming LanguagesBart
  ||||`- Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |||`* Re: Command Languages Versus Programming LanguagesMuttley
  ||| `- Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||`- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  |`* Re: Command Languages Versus Programming LanguagesEric Pozharski
  | `* Re: Command Languages Versus Programming LanguagesMuttley
  |  +- Re: Command Languages Versus Programming LanguagesJanis Papanagnou
  |  +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |  |`* Re: Command Languages Versus Programming LanguagesMuttley
  |  | `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |  |  `* Re: Command Languages Versus Programming LanguagesMuttley
  |  |   `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |  |    `- Re: Command Languages Versus Programming LanguagesMuttley
  |  `- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  `* Re: Command Languages Versus Programming LanguagesSebastian
   +* Re: Command Languages Versus Programming LanguagesMuttley
   |+* Re: Command Languages Versus Programming LanguagesWolfgang Agnes
   ||`- Re: Command Languages Versus Programming LanguagesMuttley
   |+- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
   |`* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
   | `* Re: Command Languages Versus Programming LanguagesMuttley
   |  +* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
   |  |`* Re: Command Languages Versus Programming LanguagesMuttley
   |  | `* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
   |  |  `- Re: Command Languages Versus Programming LanguagesMuttley
   |  `- Re: Command Languages Versus Programming LanguagesWolfgang Agnes
   `* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
    +* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
    |+- Re: Command Languages Versus Programming LanguagesWolfgang Agnes
    |`- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
    `* Re: Command Languages Versus Programming LanguagesRandal L. Schwartz
     +- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
     `* Re: Command Languages Versus Programming LanguagesMuttley
      +* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
      |+* Re: Command Languages Versus Programming LanguagesMuttley
      ||`* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
      || +* Re: Command Languages Versus Programming LanguagesMuttley
      || |`* Re: Command Languages Versus Programming LanguagesRainer Weikusat
      || | +* Re: Command Languages Versus Programming LanguagesJohn Ames
      || | `* Re: Command Languages Versus Programming LanguagesMuttley
      || `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
      |`* Re: Command Languages Versus Programming LanguagesKaz Kylheku
      +* Re: Command Languages Versus Programming LanguagesEd Morton
      `* Re: Command Languages Versus Programming LanguagesRainer Weikusat

Pages:1234567
Subject: Re: Command Languages Versus Programming Languages
From: Janis Papanagnou
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Wed, 20 Nov 2024 15:38 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 16:38:24 +0100
Organization: A noiseless patient Spider
Lines: 130
Message-ID: <vhkvpi$5h8v$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>
<vhkh94$2oi3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 20 Nov 2024 16:38:26 +0100 (CET)
Injection-Info: dont-email.me; posting-host="989e2dc1ebe8052ec6f7beceade503c1";
logging-data="181535"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cMrFgRHQxnPeKg0Su8It2"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:jkgCTd0VUMMZs58s7hjbAmkaJh0=
In-Reply-To: <vhkh94$2oi3$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
View all headers

On 20.11.2024 12:30, Muttley@DastartdlyHQ.org wrote:
> 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.

You haven't even tried to honestly answer my (serious) question.
With your statement above and your hostility below, it rather seems
you have no clue of what I am talking about.

>
>> 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.

The Regexps are a way to specify the words of a regular language;
for pattern matching the expression gets interpreted or compiled; you
specify it, e.g., using strings of characters and meta-characters.
If you have a programming language where that string gets repeatedly
interpreted then it's slower than a precompiled Regexp expression.

I give you examples...

(1) DES encryption function

(1a) ciphertext = des_encode (key, plaintext)

(1b) cipher = des (key)
ciphertext = cipher.encode (plaintext)

In case (1) you can either call the des encription (decription) for
any (key, plaintext)-pair in a procedural function as in (1a), or
you can create the key-specific encryption once and encode various
texts with the same cipher object as in (1b).

(2) regexp matching

(2a) location = regexp (pattern, string)

(2b) fsm = rexexp (pattern)
location = fsm.match (string)

In case (2) you can either do the match in a string with a pattern
in a procedural form as in (2a) or you can create the FSM for the
given Regexp just once and apply it on various strings as in (2b).

That's what I was talking about.

Only if key (in (1)) or pattern (in (2)) are static or "constant"
that compilation could (but only theoretically) be done in advance
and optimizing system may (or may not) precompile it (both) to
[similar] assembler code. How should that work with regexps or DES?
The optimizing system would need knowledge how to use the library
code (DES, Regexps, ...) to create binary structures based on the
algorithms (key-initialization in DES, FSM-generation in Regexps).
This is [statically] not done.

Otherwise - i.e. the normal, expected case - there's an efficiency
difference to observe between the respective cases of (a) and (b).

>
>> 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.

Why do you think so, and why are you saying that? - That wasn't and
still isn't the point. - You said upthread

"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."

and I asked

"I'm curious what you mean by Regexps presented in a "procedural"
form.
Can you give some examples?"

What you wanted to say wasn't clear to me, since you were complaining
about the _Regexp syntax_. So it couldn't be meant to just write
regexp (pattern, string) instead of pattern ~ string
but to somehow(!) transform "pattern", say, like /[0-9]+(ABC)?x*foo/,
to something syntactically "better".
I was interested in that "somehow" (that I emphasized), and in an
example how that would look like in your opinion.
If you're unable to answer that simple question then just take that
simple regexp /[0-9]+(ABC)?x*foo/ example and show us your preferred
procedural variant.

But my expectation is that you cannot provide any reasonable example
anyway.

Personally I think that writing bulky procedural stuff for something
like [0-9]+ can only be much worse, and that further abbreviations
like \d+ are the better direction to go if targeting a good interface.
YMMV.

Janis

Subject: Re: Command Languages Versus Programming Languages
From: Janis Papanagnou
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Wed, 20 Nov 2024 15:53 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 16:53:38 +0100
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <vhl0m3$5mu9$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> <vhki79$2pho$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 20 Nov 2024 16:53:40 +0100 (CET)
Injection-Info: dont-email.me; posting-host="989e2dc1ebe8052ec6f7beceade503c1";
logging-data="187337"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OiBEg5Wjx+/Qc598MdGUg"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:QEGDWPnuL1M6q+rkt6qWgXeH5OM=
In-Reply-To: <vhki79$2pho$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
View all headers

On 20.11.2024 12:46, Ed Morton wrote:
>
> 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.

(Worth a scribbling on a WC wall.)

>
> 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).

Regexps are nothing for newbies.

The inherent fine thing with Regexps is that you can incrementally
compose them[*].[**]

It seems you haven't found a sensible way to work with them?
(And I'm really astonished about that since I know you worked with
Regexps for years if not decades.)

In those cases where Regexps *are* the tool for a specific task -
I don't expect you to use them where they are inappropriate?! -
what would be the better solution[***] then?

Janis

[*] Like the corresponding FSMs.

[**] And you can also decompose them if they are merged in a huge
expression, too large for you to grasp it. (BTW, I'm doing such
decompositions also with other expressions in program code that
are too bulky.)

[***] Can you answer the question that another poster failed to do?

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Wed, 20 Nov 2024 16:38 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: 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 16:38:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <vhl39n$67lp$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>
<vhkh94$2oi3$1@dont-email.me>
<vhkvpi$5h8v$1@dont-email.me>
Injection-Date: Wed, 20 Nov 2024 17:38:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="36fbe858f1cae8ac98599318d5cdf800";
logging-data="204473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u1JR5/k7Q1uHZDFnsCAZb"
Cancel-Lock: sha1:+Dg5PqzRO8xrWyI8hYws+4lyjXc=
View all headers

On Wed, 20 Nov 2024 16:38:24 +0100
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> boring babbled:
>On 20.11.2024 12:30, Muttley@DastartdlyHQ.org wrote:
>> 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.
>
>You haven't even tried to honestly answer my (serious) question.

You mean you can't figure out how to do something like string search and replace
procedurally? I'm not going to show you, ask a kid who knows Python or Basic.

>With your statement above and your hostility below, it rather seems

If you think my reply was hostile then I suggest you go find a safe space
and cuddle your teddy bear snowflake.

Subject: Re: Command Languages Versus Programming Languages
From: Rainer Weikusat
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Date: Wed, 20 Nov 2024 17:50 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 17:50:13 +0000
Lines: 19
Message-ID: <875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
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>
<vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net CkOZwEdFT6Gr00Qv2xiZuQ9NOvkZZbQFjEGgZdVy1I4oQmDgg=
Cancel-Lock: sha1:XjlhxEGeHYRd5TDLXg0JYOJU85E= sha1:BBAipndnc5ZTihIhNzq2/cNgikg= sha256:Nk49T4SFLW+JAoP4gmrEcHywNbKSMCDGfguWSPelZFQ=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

[...]

> Personally I think that writing bulky procedural stuff for something
> like [0-9]+ can only be much worse, and that further abbreviations
> like \d+ are the better direction to go if targeting a good interface.
> YMMV.

Assuming that p is a pointer to the current position in a string, e is a
pointer to the end of it (ie, point just past the last byte) and -
that's important - both are pointers to unsigned quantities, the 'bulky'
C equivalent of [0-9]+ is

while (p < e && *p - '0' < 10) ++p;

That's not too bad. And it's really a hell lot faster than a
general-purpose automaton programmed to recognize the same pattern
(which might not matter most of the time, but sometimes, it does).

Subject: Re: Command Languages Versus Programming Languages
From: Rainer Weikusat
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Date: Wed, 20 Nov 2024 17:54 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 17:54:22 +0000
Lines: 11
Message-ID: <87y11daj01.fsf@doppelsaurus.mobileactivedefense.com>
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>
<vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me>
<vhl39n$67lp$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net d3waHWir40ZPSGxlPTh1KAF75GhvzWjxqDeUXvii6WiOtyDNQ=
Cancel-Lock: sha1:kakB+2t59z/Vr5wqwLS2VblER/U= sha1:zGDXLT5f0p+5bpzG0GJkokM/WSQ= sha256:rjZoCWs88SDUZW+7CdYUE6coqrE3hdlhcZAV+tCeJ8A=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

Muttley@DastartdlyHQ.org writes:

[...]

>>With your statement above and your hostility below, it rather seems
>
> If you think my reply was hostile then I suggest you go find a safe space
> and cuddle your teddy bear snowflake.

There's surely no reason why anyone could ever think you were inclined
to substitute verbal aggression for arguments.

Subject: Re: Command Languages Versus Programming Languages
From: John Ames
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Wed, 20 Nov 2024 18:03 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: commodorejohn@gmail.com (John Ames)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 10:03:47 -0800
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <20241120100347.00005f10@gmail.com>
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>
<vhkh94$2oi3$1@dont-email.me>
<vhkvpi$5h8v$1@dont-email.me>
<vhl39n$67lp$1@dont-email.me>
<87y11daj01.fsf@doppelsaurus.mobileactivedefense.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 20 Nov 2024 19:03:51 +0100 (CET)
Injection-Info: dont-email.me; posting-host="1d4d552e0e1638357ca11738d2f1dc83";
logging-data="224659"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+P1T8Gmo88T4eiqMYzUZOAvqlWgYv05fc="
Cancel-Lock: sha1:uwk+Z5EhVOQaLMvVdoDMwnBuUNI=
X-Newsreader: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-w64-mingw32)
View all headers

On Wed, 20 Nov 2024 17:54:22 +0000
Rainer Weikusat <rweikusat@talktalk.net> wrote:

> There's surely no reason why anyone could ever think you were inclined
> to substitute verbal aggression for arguments.

I mean, it's his whole thing - why would he stop now?

Subject: Re: Command Languages Versus Programming Languages
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Wed, 20 Nov 2024 21:43 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 21:43:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <vhll6c$9gjn$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> <vhki79$2pho$1@dont-email.me>
<vhkkka$3dja$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 20 Nov 2024 22:43:41 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c8a5d8f8287a46a043b46813003956ce";
logging-data="311927"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19k0oIyF1qd3ueHPHK2I7um"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:PPf5N4l7AghiwMzoAT5o0zYqlrs=
View all headers

On Wed, 20 Nov 2024 12:27:54 -0000 (UTC), Muttley wrote:

> Edge cases are regex achilles heal, eg an expression that only accounted
> for 1 -> N chars, not 0 -> N, or matches in the middle but not at the
> ends.

That’s what “^” and “$” are for.

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 08:13 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Path: 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: Thu, 21 Nov 2024 08:13:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <vhmq3j$ifkd$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>
<vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me>
<vhl39n$67lp$1@dont-email.me>
<87y11daj01.fsf@doppelsaurus.mobileactivedefense.com>
Injection-Date: Thu, 21 Nov 2024 09:13:39 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2e0de010e7fdf12514a4fb3f342f347e";
logging-data="605837"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jh/1RRwyyCXyiXfKdYfyr"
Cancel-Lock: sha1:VcsJhZYUBX7R1FsfUsZvqsUWF7Y=
View all headers

On Wed, 20 Nov 2024 17:54:22 +0000
Rainer Weikusat <rweikusat@talktalk.net> boring babbled:
>Muttley@DastartdlyHQ.org writes:
>
>[...]
>
>>>With your statement above and your hostility below, it rather seems
>>
>> If you think my reply was hostile then I suggest you go find a safe space
>> and cuddle your teddy bear snowflake.
>
>There's surely no reason why anyone could ever think you were inclined
>to substitute verbal aggression for arguments.

I have zero time for anyone who claims hurt feelings or being slighted as
soon as they're losing an argument.

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 08:15 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Path: 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: Thu, 21 Nov 2024 08:15:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhmq7d$ig5d$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> <vhki79$2pho$1@dont-email.me>
<vhkkka$3dja$1@dont-email.me>
<vhll6c$9gjn$1@dont-email.me>
Injection-Date: Thu, 21 Nov 2024 09:15:41 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2e0de010e7fdf12514a4fb3f342f347e";
logging-data="606381"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OdbPCEDA6yVBEdnYcFGT+"
Cancel-Lock: sha1:fVgmoQJrSLE/uQ04XprMa2hUjKo=
View all headers

On Wed, 20 Nov 2024 21:43:41 -0000 (UTC)
Lawrence D'Oliveiro <ldo@nz.invalid> boring babbled:
>On Wed, 20 Nov 2024 12:27:54 -0000 (UTC), Muttley wrote:
>
>> Edge cases are regex achilles heal, eg an expression that only accounted
>> for 1 -> N chars, not 0 -> N, or matches in the middle but not at the
>> ends.
>
>That’s what “^” and “$” are for.

Yes, but people forget about those (literal) edge cases.

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 08:18 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Path: 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: Thu, 21 Nov 2024 08:18:06 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhmqbu$iglq$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>
<vhkh94$2oi3$1@dont-email.me>
<vhkvpi$5h8v$1@dont-email.me>
<vhl39n$67lp$1@dont-email.me>
<87y11daj01.fsf@doppelsaurus.mobileactivedefense.com>
<20241120100347.00005f10@gmail.com>
Injection-Date: Thu, 21 Nov 2024 09:18:07 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2e0de010e7fdf12514a4fb3f342f347e";
logging-data="606906"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Bizg6EFWQGLYUlb9s8FOA"
Cancel-Lock: sha1:6JGR/RcmC2Dx1HxEwMopC+Ep14o=
View all headers

On Wed, 20 Nov 2024 10:03:47 -0800
John Ames <commodorejohn@gmail.com> boring babbled:
>On Wed, 20 Nov 2024 17:54:22 +0000
>Rainer Weikusat <rweikusat@talktalk.net> wrote:
>
>> There's surely no reason why anyone could ever think you were inclined
>> to substitute verbal aggression for arguments.
>
>I mean, it's his whole thing - why would he stop now?

Whats it like being so wet? Do you get cold easily?

Subject: Re: Command Languages Versus Programming Languages
From: Randal L. Schwartz
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: Stonehenge Consulting Services; Portland, Oregon, USA
Date: Thu, 21 Nov 2024 13:38 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!news-out.netnews.com!postmaster.netnews.com!us3.netnews.com!not-for-mail
X-Trace: DXC=>fSjDJT66O^_4YChK]9ALRHWonT5<]0T]Q;nb^V>PUfV5[gZBW6J?L\RQ?47NQ;EP[WL0F@FY:]_^^W@Ha225UCYmeBhC3baPoTH8NJTJCLWdZ
X-Complaints-To: support@blocknews.net
From: merlyn@stonehenge.com (Randal L. Schwartz)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
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> <871pz62j0v.fsf@doppelsaurus.mobileactivedefense.com>
x-mayan-date: Long count = 13.0.12.1.13; tzolkin = 2 Ben; haab = 16 Ceh
Date: Thu, 21 Nov 2024 05:38:45 -0800
Message-ID: <86bjy8n1ui.fsf@red.stonehenge.com>
Organization: Stonehenge Consulting Services; Portland, Oregon, USA
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix)
Cancel-Lock: sha1:GOB6Nyk6zuZ0dD27uOjLN7p6iGk=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Lines: 17
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1732196583 reader.netnews.com 3620704 127.0.0.1:33937
View all headers

>>>>> "Rainer" == Rainer Weikusat <rweikusat@talktalk.net> writes:

Rainer> ¹ I used to use a JSON parser written in OO-Perl which made
Rainer> extensive use of regexes for that. I've recently replaced that
Rainer> with a C/XS version which - while slightly larger (617 vs 410
Rainer> lines of text) - is over a hundred times faster and conceptually
Rainer> simpler at the same time.

I wonder if that was my famous "JSON parser in a single regex" from
https://www.perlmonks.org/?node_id=995856, or from one of the two CPAN
modules that incorporated it.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Dart/Flutter consulting, Technical writing, Comedy, etc. etc.
Still trying to think of something clever for the fourth line of this .sig

Subject: Re: Command Languages Versus Programming Languages
From: Dan Cross
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: PANIX Public Access Internet and UNIX, NYC
Date: Thu, 21 Nov 2024 14:13 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 14:13:37 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <vhnf6h$bfa$1@reader2.panix.com>
References: <uu54la$3su5b$6@dont-email.me> <vhl39n$67lp$1@dont-email.me> <87y11daj01.fsf@doppelsaurus.mobileactivedefense.com> <20241120100347.00005f10@gmail.com>
Injection-Date: Thu, 21 Nov 2024 14:13:37 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="11754"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
View all headers

In article <20241120100347.00005f10@gmail.com>,
John Ames <commodorejohn@gmail.com> wrote:
>On Wed, 20 Nov 2024 17:54:22 +0000
>Rainer Weikusat <rweikusat@talktalk.net> wrote:
>
>> There's surely no reason why anyone could ever think you were inclined
>> to substitute verbal aggression for arguments.
>
>I mean, it's his whole thing - why would he stop now?

This is the guy who didn't know what a compiler is, right?

- Dan C.

Subject: Re: Command Languages Versus Programming Languages
From: Dan Cross
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: PANIX Public Access Internet and UNIX, NYC
Date: Thu, 21 Nov 2024 14:40 UTC
References: 1 2 3 4
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 14:40:18 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <vhngoi$2p6$1@reader2.panix.com>
References: <uu54la$3su5b$6@dont-email.me> <vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me> <875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
Injection-Date: Thu, 21 Nov 2024 14:40:18 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="2854"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
View all headers

In article <875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>,
Rainer Weikusat <rweikusat@talktalk.net> wrote:
>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>
>[...]
>
>> Personally I think that writing bulky procedural stuff for something
>> like [0-9]+ can only be much worse, and that further abbreviations
>> like \d+ are the better direction to go if targeting a good interface.
>> YMMV.
>
>Assuming that p is a pointer to the current position in a string, e is a
>pointer to the end of it (ie, point just past the last byte) and -
>that's important - both are pointers to unsigned quantities, the 'bulky'
>C equivalent of [0-9]+ is
>
>while (p < e && *p - '0' < 10) ++p;
>
>That's not too bad. And it's really a hell lot faster than a
>general-purpose automaton programmed to recognize the same pattern
>(which might not matter most of the time, but sometimes, it does).

It's also not exactly right. `[0-9]+` would match one or more
characters; this possibly matches 0 (ie, if `p` pointed to
something that wasn't a digit).

- Dan C.

Subject: Re: Command Languages Versus Programming Languages
From: Rainer Weikusat
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Date: Thu, 21 Nov 2024 15:07 UTC
References: 1 2 3 4 5
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 15:07:42 +0000
Lines: 29
Message-ID: <874j40sk01.fsf@doppelsaurus.mobileactivedefense.com>
References: <uu54la$3su5b$6@dont-email.me> <vhkh94$2oi3$1@dont-email.me>
<vhkvpi$5h8v$1@dont-email.me>
<875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
<vhngoi$2p6$1@reader2.panix.com>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net O3HcDZSMoC5bQXIZ0hwVuAeEjigWzFJ1OS8imXmOeGiqDPeXk=
Cancel-Lock: sha1:D+T9SN8ldpc3ZEPVfdyih7+3rWk= sha1:wzBVcF/2jEJO9xuiHEarTsOEDVY= sha256:yxX+5rPLFNjEL0zy75Ml/zE7579viIF4ErT31+sX0js=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

cross@spitfire.i.gajendra.net (Dan Cross) writes:
> Rainer Weikusat <rweikusat@talktalk.net> wrote:
>>Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>
>>[...]
>>
>>> Personally I think that writing bulky procedural stuff for something
>>> like [0-9]+ can only be much worse, and that further abbreviations
>>> like \d+ are the better direction to go if targeting a good interface.
>>> YMMV.
>>
>>Assuming that p is a pointer to the current position in a string, e is a
>>pointer to the end of it (ie, point just past the last byte) and -
>>that's important - both are pointers to unsigned quantities, the 'bulky'
>>C equivalent of [0-9]+ is
>>
>>while (p < e && *p - '0' < 10) ++p;
>>
>>That's not too bad. And it's really a hell lot faster than a
>>general-purpose automaton programmed to recognize the same pattern
>>(which might not matter most of the time, but sometimes, it does).
>
> It's also not exactly right. `[0-9]+` would match one or more
> characters; this possibly matches 0 (ie, if `p` pointed to
> something that wasn't a digit).

The regex won't match any digits if there aren't any. In this case, the
match will fail. I didn't include the code for handling that because it
seemed pretty pointless for the example.

Subject: Re: Command Languages Versus Programming Languages
From: John Ames
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 15:56 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: commodorejohn@gmail.com (John Ames)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 07:56:48 -0800
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <20241121075648.000070a4@gmail.com>
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>
<vhkh94$2oi3$1@dont-email.me>
<vhkvpi$5h8v$1@dont-email.me>
<vhl39n$67lp$1@dont-email.me>
<87y11daj01.fsf@doppelsaurus.mobileactivedefense.com>
<20241120100347.00005f10@gmail.com>
<vhmqbu$iglq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 21 Nov 2024 16:56:53 +0100 (CET)
Injection-Info: dont-email.me; posting-host="9765dc5b37d2dae4cadd43e7290cd173";
logging-data="715789"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2ThUbQILbgQClAxQ9u4Yaj5LJFAvI6eM="
Cancel-Lock: sha1:Amqudo5KBWMWtRiSq9Wh8KxbQ5M=
X-Newsreader: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-w64-mingw32)
View all headers

On Thu, 21 Nov 2024 08:18:06 -0000 (UTC)
Muttley@DastartdlyHQ.org wrote:

> Whats it like being so wet? Do you get cold easily?

No, I have a soft gray hoodie with a nice fleecy lining that I quite
like. It's very warm for not being too heavy.

Also: *huh?*

Subject: Re: Command Languages Versus Programming Languages
From: John Ames
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 15:58 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: commodorejohn@gmail.com (John Ames)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 07:58:06 -0800
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <20241121075806.0000685c@gmail.com>
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>
<vhkh94$2oi3$1@dont-email.me>
<vhkvpi$5h8v$1@dont-email.me>
<vhl39n$67lp$1@dont-email.me>
<87y11daj01.fsf@doppelsaurus.mobileactivedefense.com>
<vhmq3j$ifkd$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 21 Nov 2024 16:58:10 +0100 (CET)
Injection-Info: dont-email.me; posting-host="9765dc5b37d2dae4cadd43e7290cd173";
logging-data="715789"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4wYZwwQeptNrBIHLFNsAMN/gcBXKBv/k="
Cancel-Lock: sha1:ZRAfohOdo8GsbOC4/51lPe3Rbm4=
X-Newsreader: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-w64-mingw32)
View all headers

On Thu, 21 Nov 2024 08:13:39 -0000 (UTC)
Muttley@DastartdlyHQ.org wrote:

> I have zero time

I approve, it's a wonderful album!

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 16:06 UTC
References: 1 2 3 4 5
Path: 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: Thu, 21 Nov 2024 16:06:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <vhnlp9$n3nn$1@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <vhl39n$67lp$1@dont-email.me> <87y11daj01.fsf@doppelsaurus.mobileactivedefense.com> <20241120100347.00005f10@gmail.com> <vhnf6h$bfa$1@reader2.panix.com>
Injection-Date: Thu, 21 Nov 2024 17:06:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2e0de010e7fdf12514a4fb3f342f347e";
logging-data="757495"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QssVu9TINw89pPySFijD2"
Cancel-Lock: sha1:7GigIzc9r2NzAK2I6FXeanEdKvY=
View all headers

On Thu, 21 Nov 2024 14:13:37 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) boring babbled:
>In article <20241120100347.00005f10@gmail.com>,
>John Ames <commodorejohn@gmail.com> wrote:
>>On Wed, 20 Nov 2024 17:54:22 +0000
>>Rainer Weikusat <rweikusat@talktalk.net> wrote:
>>
>>> There's surely no reason why anyone could ever think you were inclined
>>> to substitute verbal aggression for arguments.
>>
>>I mean, it's his whole thing - why would he stop now?
>
>This is the guy who didn't know what a compiler is, right?

Wrong. Want another go?

Subject: Re: Command Languages Versus Programming Languages
From: Rainer Weikusat
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Date: Thu, 21 Nov 2024 17:01 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 17:01:48 +0000
Lines: 22
Message-ID: <87v7wgr05f.fsf@doppelsaurus.mobileactivedefense.com>
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>
<871pz62j0v.fsf@doppelsaurus.mobileactivedefense.com>
<86bjy8n1ui.fsf@red.stonehenge.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net Un16VQBAl7MB8ADrUii53gPkVQzwWrZ+FEMsI3EKjjgBCWsKY=
Cancel-Lock: sha1:Z3lbJ0LV92mupzE89hlReh3Hxlg= sha1:Kv2vCIYbTpWV4EwWvEtcUqwQ14c= sha256:qiVVpWzghq3GIWbDeqowPQ/JF0p6pXuXbkiXx6ukDbs=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

merlyn@stonehenge.com (Randal L. Schwartz) writes:
>>>>>> "Rainer" == Rainer Weikusat <rweikusat@talktalk.net> writes:
> Rainer> ¹ I used to use a JSON parser written in OO-Perl which made
> Rainer> extensive use of regexes for that. I've recently replaced that
> Rainer> with a C/XS version which - while slightly larger (617 vs 410
> Rainer> lines of text) - is over a hundred times faster and conceptually
> Rainer> simpler at the same time.
>
> I wonder if that was my famous "JSON parser in a single regex" from
> https://www.perlmonks.org/?node_id=995856, or from one of the two CPAN
> modules that incorporated it.

No. One of my use-cases is an interactive shell running in a web browser
using ActionCable messages to relay data between the browser and the
shell process on the computer supposed to be accessed in this way. For
this, I absolutely do need \u escapes. I also need this to be fast. Eg,
one of the nice properties of JSON is that the type of a value can be
determined by looking at the first character of it. This cries for an
implementation based on an array of pointers to 'value parsing routines'
of size 256 and determining the parser routine to use by using the first
character as index into this table (which will either yield a pointer to
the correct parser routine or NULL for a syntax error).

Subject: Re: Command Languages Versus Programming Languages
From: Kaz Kylheku
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 19:12 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 643-408-1753@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 19:12:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <20241121110710.49@kylheku.com>
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: Thu, 21 Nov 2024 20:12:04 +0100 (CET)
Injection-Info: dont-email.me; posting-host="36da3229789b5c97e0772a325117b596";
logging-data="818797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wCY36UG1BEC8DvVgduU9kz45eYhnjM5w="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:G/CL3T8UERwNIRoEzvTp3ULZxr0=
View all headers

On 2024-11-20, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> On 20.11.2024 09:21, Muttley@DastartdlyHQ.org wrote:
>> 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.

These features solve the problem of regexes being stored as character
strings not being recognized by the language compiler and then having
to be compiled at run-time.

They don't solve all the ergonomics of regexes that Muttley is talking
about.

> I'm curious what you mean by Regexps presented in a "procedural" form.
> Can you give some examples?

Here is an example: using a regex match to capture a C comment /* ... */
in Lex compared to just recognizing the start sequence /* and handling
the discarding of the comment in the action.

Without non-greedy repetition matching, the regex for a C comment is
quite obtuse. The procedural handling is straightforward: read
characters until you see a * immediately followed by a /.

In the wild, you see regexes being used for all sorts of stupid stuff,
like checking whether numeric input is in a certain range, rather than
converting it to a number and doing an arithmetic check.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Subject: Re: Command Languages Versus Programming Languages
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Thu, 21 Nov 2024 22:05 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Thu, 21 Nov 2024 22:05:13 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <vhoaqp$qjkl$4@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> <vhki79$2pho$1@dont-email.me>
<vhkkka$3dja$1@dont-email.me> <vhll6c$9gjn$1@dont-email.me>
<vhmq7d$ig5d$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 21 Nov 2024 23:05:14 +0100 (CET)
Injection-Info: dont-email.me; posting-host="ef08745908c980c7c50adf3dc90da7e8";
logging-data="872085"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DTo+voEQ1hnAoguVTZWoO"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:WRu22OGMlCB6DHGCaWEAIllEyDM=
View all headers

On Thu, 21 Nov 2024 08:15:41 -0000 (UTC), Muttley wrote:

> On Wed, 20 Nov 2024 21:43:41 -0000 (UTC)
> Lawrence D'Oliveiro <ldo@nz.invalid> boring babbled:
>
>>On Wed, 20 Nov 2024 12:27:54 -0000 (UTC), Muttley wrote:
>>
>>> Edge cases are regex achilles heal, eg an expression that only
>>> accounted for 1 -> N chars, not 0 -> N, or matches in the middle but
>>> not at the ends.
>>
>>That’s what “^” and “$” are for.
>
> Yes, but people forget about those (literal) edge cases.

Those of us who are accustomed to using regexes do not.

Another handy one is “\b” for word boundaries.

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 10:09 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: 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: Fri, 22 Nov 2024 10:09:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <vhpl9c$14mdr$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>
<20241121110710.49@kylheku.com>
Injection-Date: Fri, 22 Nov 2024 11:09:48 +0100 (CET)
Injection-Info: dont-email.me; posting-host="db1e6cbba22b211bfa08c9ad697b09ce";
logging-data="1202619"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kOg2VcK4yqfAVnfT4w1HQ"
Cancel-Lock: sha1:VhzWNRP2DjuFH3zhW8YgwRpdSs4=
View all headers

On Thu, 21 Nov 2024 19:12:03 -0000 (UTC)
Kaz Kylheku <643-408-1753@kylheku.com> boring babbled:
>On 2024-11-20, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>> I'm curious what you mean by Regexps presented in a "procedural" form.
>> Can you give some examples?
>
>Here is an example: using a regex match to capture a C comment /* ... */
>in Lex compared to just recognizing the start sequence /* and handling
>the discarding of the comment in the action.
>
>Without non-greedy repetition matching, the regex for a C comment is
>quite obtuse. The procedural handling is straightforward: read
>characters until you see a * immediately followed by a /.

Its not that simple I'm afraid since comments can be commented out.

eg:

// int i; /*
int j;
/*
int k;
*/
++j;

A C99 and C++ compiler would see "int j" and compile it, a regex would
simply remove everything from the first /* to */.

Also the same probably applies to #ifdef's.

Subject: Re: Command Languages Versus Programming Languages
From: Janis Papanagnou
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 11:14 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Fri, 22 Nov 2024 12:14:32 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <vhpp2q$15aen$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>
<vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me>
<875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Nov 2024 12:14:34 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0bffdfc6132b7c2549c575b8240be95d";
logging-data="1223127"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184zGmswKc1ampVLAKBsmiL"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:X2S9NQAlsBbkHc/ycIgeblM2kn4=
In-Reply-To: <875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
X-Enigmail-Draft-Status: N1110
View all headers

On 20.11.2024 18:50, Rainer Weikusat wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>
>> Personally I think that writing bulky procedural stuff for something
>> like [0-9]+ can only be much worse, and that further abbreviations
>> like \d+ are the better direction to go if targeting a good interface.
>> YMMV.
>
> Assuming that p is a pointer to the current position in a string, e is a
> pointer to the end of it (ie, point just past the last byte) and -
> that's important - both are pointers to unsigned quantities, the 'bulky'
> C equivalent of [0-9]+ is
>
> while (p < e && *p - '0' < 10) ++p;
>
> That's not too bad. And it's really a hell lot faster than a
> general-purpose automaton programmed to recognize the same pattern
> (which might not matter most of the time, but sometimes, it does).

Okay, I see where you're coming from (and especially in that simple
case).

Personally (and YMMV), even here in this simple case I think that
using pointers is not better but worse - and anyway isn't [in this
form] available in most languages; in other cases (and languages)
such constructs get yet more clumsy, and for my not very complex
example - /[0-9]+(ABC)?x*foo/ - even a "catastrophe" concerning
readability, error-proneness, and maintainability.

If that is what the other poster meant I'm fine with your answer;
there's no need to even consider abandoning regular expressions
in favor of explicitly codified parsing.

Janis

PS: And thanks for answering on behalf of the other poster whom I
see in his followups just continuing his very personal style.

Subject: Re: Command Languages Versus Programming Languages
From: Janis Papanagnou
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 11:17 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Fri, 22 Nov 2024 12:17:56 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhpp96$15bjl$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>
<20241121110710.49@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 22 Nov 2024 12:17:58 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0bffdfc6132b7c2549c575b8240be95d";
logging-data="1224309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5rOL+2rQJH1Ar1KaOWUdH"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:pKsp3VHftNE6UaVyMSkjCqKOZRg=
In-Reply-To: <20241121110710.49@kylheku.com>
View all headers

On 21.11.2024 20:12, Kaz Kylheku wrote:
> [...]
>
> In the wild, you see regexes being used for all sorts of stupid stuff,

No one can prevent folks using features for stupid things. Yes.

> like checking whether numeric input is in a certain range, rather than
> converting it to a number and doing an arithmetic check.

Janis

Subject: Re: Command Languages Versus Programming Languages
From: Janis Papanagnou
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 11:47 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Fri, 22 Nov 2024 12:47:16 +0100
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <vhpr06$15kuj$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> <vhki79$2pho$1@dont-email.me>
<vhkkka$3dja$1@dont-email.me> <vhll6c$9gjn$1@dont-email.me>
<vhmq7d$ig5d$1@dont-email.me> <vhoaqp$qjkl$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 12:47:22 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0bffdfc6132b7c2549c575b8240be95d";
logging-data="1233875"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F7d22DOROO9EKFxz8C2BF"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:h+5lnFaPgluT0FMJ/xdc0VB7kNA=
In-Reply-To: <vhoaqp$qjkl$4@dont-email.me>
X-Enigmail-Draft-Status: N1110
View all headers

On 21.11.2024 23:05, Lawrence D'Oliveiro wrote:
> On Thu, 21 Nov 2024 08:15:41 -0000 (UTC), Muttley wrote:
>> On Wed, 20 Nov 2024 21:43:41 -0000 (UTC)
>> Lawrence D'Oliveiro <ldo@nz.invalid> boring babbled:
>>[...]
>>>
>>> That’s what “^” and “$” are for.
>>
>> Yes, but people forget about those (literal) edge cases.

But *only* _literally_ "edge cases". Rather they're simple
and basics of regexp parsers since their beginning.

> Those of us who are accustomed to using regexes do not.

It's one of the first things that regexp newbies learn,
I'd say.

>
> Another handy one is “\b” for word boundaries.

I prefer \< and \> (that are quite commonly used) for such
structural things, also \( and \) for allowing references
to matched parts. And I prefer the \alpha regexp pattern
extension forms for things like \d \D \w \W \s \S . (But
that's not only a matter of taste but also a question of
what any regexp parser actually supports.)

Janis

Subject: Re: Command Languages Versus Programming Languages
From: Rainer Weikusat
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Date: Fri, 22 Nov 2024 11:56 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: rweikusat@talktalk.net (Rainer Weikusat)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Fri, 22 Nov 2024 11:56:26 +0000
Lines: 56
Message-ID: <87wmgvzdlh.fsf@doppelsaurus.mobileactivedefense.com>
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>
<vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me>
<875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
<vhpp2q$15aen$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 4R3ou5/+SK9skO5RhCTZFwduxo3vMRsdBX6Clp2nC7PsAgH9Y=
Cancel-Lock: sha1:SuM1q8Ju0ZeeqfhVv48yHHHrluI= sha1:RMgnVlR65EFI7uvEuNnVY41nH9k= sha256:OdcvETt2ZjenvuI3NdmGzWJksSQdzk/x5r9PIvxbUA0=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
View all headers

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 20.11.2024 18:50, Rainer Weikusat wrote:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>
>>> Personally I think that writing bulky procedural stuff for something
>>> like [0-9]+ can only be much worse, and that further abbreviations
>>> like \d+ are the better direction to go if targeting a good interface.
>>> YMMV.
>>
>> Assuming that p is a pointer to the current position in a string, e is a
>> pointer to the end of it (ie, point just past the last byte) and -
>> that's important - both are pointers to unsigned quantities, the 'bulky'
>> C equivalent of [0-9]+ is
>>
>> while (p < e && *p - '0' < 10) ++p;
>>
>> That's not too bad. And it's really a hell lot faster than a
>> general-purpose automaton programmed to recognize the same pattern
>> (which might not matter most of the time, but sometimes, it does).
>
> Okay, I see where you're coming from (and especially in that simple
> case).
>
> Personally (and YMMV), even here in this simple case I think that
> using pointers is not better but worse - and anyway isn't [in this
> form] available in most languages;

That's a question of using the proper tool for the job. In C, that's
pointer and pointer arithmetic because it's the simplest way to express
something like this.

> in other cases (and languages)
> such constructs get yet more clumsy, and for my not very complex
> example - /[0-9]+(ABC)?x*foo/ - even a "catastrophe" concerning
> readability, error-proneness, and maintainability.

Procedural code for matching strings constructed in this way is
certainly much simpler¹ than the equally procedural code for a
programmable automaton capable of interpreting regexes. Your statement
is basically "If we assume that the code interpreting regexes doesn't
exist, regexes need much less code than something equivalent which does
exist." Without this assumption, the picture becomes a different one
altogether.

¹ This doesn't even need a real state machine, just four subroutines
executed in succession (and two of these can share an implementation as
"matching ABC" and "matching foo" are both cases of matching a constant
string.

> If that is what the other poster meant I'm fine with your answer;
> there's no need to even consider abandoning regular expressions
> in favor of explicitly codified parsing.

This depends on the specific problem and the constraints applicable to a
solution. For the common case, regexes, if easily available, are an
obvious good solution. But not all cases are common.

Pages:1234567

rocksolid light 0.9.8
clearnet tor