Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Asynchronous inputs are at the root of our race problems. -- D. Winker and F. Prosser


devel / comp.lang.c / Re: C vs Haskell for XML parsing

SubjectAuthor
* C vs Haskell for XML parsingMalcolm McLean
+* Re: C vs Haskell for XML parsingBart
|+* Re: C vs Haskell for XML parsingBen Bacarisse
||`* Re: C vs Haskell for XML parsingMalcolm McLean
|| `* Re: C vs Haskell for XML parsingBen Bacarisse
||  `* Re: C vs Haskell for XML parsingMalcolm McLean
||   `* Re: C vs Haskell for XML parsingBen Bacarisse
||    +* Re: C vs Haskell for XML parsingMalcolm McLean
||    |`- Re: C vs Haskell for XML parsingBen Bacarisse
||    `* Re: C vs Haskell for XML parsingMalcolm McLean
||     +- Re: C vs Haskell for XML parsingLew Pitcher
||     +* Re: C vs Haskell for XML parsingScott Lurndal
||     |+* Re: C vs Haskell for XML parsingLew Pitcher
||     ||+- Re: C vs Haskell for XML parsingLew Pitcher
||     ||`- Re: C vs Haskell for XML parsingScott Lurndal
||     |`* Re: C vs Haskell for XML parsingBen Bacarisse
||     | `- Re: C vs Haskell for XML parsingScott Lurndal
||     `* Re: C vs Haskell for XML parsingBen Bacarisse
||      `* Re: C vs Haskell for XML parsingMalcolm McLean
||       +- Re: C vs Haskell for XML parsingRichard Damon
||       `* Re: C vs Haskell for XML parsingBen Bacarisse
||        `* Re: C vs Haskell for XML parsingMalcolm McLean
||         +- Re: C vs Haskell for XML parsingKeith Thompson
||         `* Re: C vs Haskell for XML parsingBen Bacarisse
||          +* Re: C vs Haskell for XML parsingMalcolm McLean
||          |`- Re: C vs Haskell for XML parsingBen Bacarisse
||          `* Re: C vs Haskell for XML parsingDavid Brown
||           +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |`* Re: C vs Haskell for XML parsingDavid Brown
||           | `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |  `* Re: C vs Haskell for XML parsingDavid Brown
||           |   +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   |+* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   || `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||  `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||   `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||    `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     +* Re: C vs Haskell for XML parsingBart
||           |   ||     |`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     | `- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     +* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     | +- Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     | `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |  `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |   `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |    `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |     +* Re: C vs Haskell for XML parsingBart
||           |   ||     |     |+* Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |     ||`- Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |     |`- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |     `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      |+* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      ||+* Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     |      |||`* Re: C vs Haskell for XML parsingLew Pitcher
||           |   ||     |      ||| `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      |||  `- Re: C vs Haskell for XML parsingLew Pitcher
||           |   ||     |      ||+* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      |||`* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      ||| `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      |||  `- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      ||`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || +* Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     |      || |`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || | +- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || | `* Re: C vs Haskell for XML parsingJames Kuyper
||           |   ||     |      || |  +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  |+* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||`* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  || `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||  `* Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |      || |  ||   +- Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  ||   `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||    `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  ||     `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      || |  ||      `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  ||       `- Re: C vs Haskell for XML parsingTim Rentsch
||           |   ||     |      || |  |+* Re: C vs Haskell for XML parsingKaz Kylheku
||           |   ||     |      || |  ||`- Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      || |  |+- Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      || |  |`- Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      || |  `- Re: C vs Haskell for XML parsingScott Lurndal
||           |   ||     |      || `* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      ||  `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      ||   +- Re: C vs Haskell for XML parsingChris M. Thomasson
||           |   ||     |      ||   `- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      |`* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      | +* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |+* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||+* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |||+- Re: C vs Haskell for XML parsingBen Bacarisse
||           |   ||     |      | |||+* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||`* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |||| `* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||  `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | ||||   `* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||    `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | ||||     `* Re: C vs Haskell for XML parsingRichard Damon
||           |   ||     |      | ||||      `* Re: C vs Haskell for XML parsingKeith Thompson
||           |   ||     |      | |||`- Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      | ||`* Re: C vs Haskell for XML parsingBart
||           |   ||     |      | |`* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      | `* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      +- Re: C vs Haskell for XML parsingSpiros Bousbouras
||           |   ||     |      +* Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     |      +* Underscores in type names (was : C vs Haskell for XML parsing)Spiros Bousbouras
||           |   ||     |      +* Re: C vs Haskell for XML parsingDavid Brown
||           |   ||     |      `- Re: C vs Haskell for XML parsingMalcolm McLean
||           |   ||     `- Re: C vs Haskell for XML parsingKeith Thompson
||           |   |`- Re: C vs Haskell for XML parsingScott Lurndal
||           |   `- Re: C vs Haskell for XML parsingBart
||           `- Re: C vs Haskell for XML parsingBen Bacarisse
|+* Re: C vs Haskell for XML parsingfir
|`* Re: C vs Haskell for XML parsingKaz Kylheku
+- Re: C vs Haskell for XML parsingBen Bacarisse
+- Re: C vs Haskell for XML parsingfir
`* Re: C vs Haskell for XML parsingfir

Pages:123456789101112
Re: C vs Haskell for XML parsing

<ucg0lf$18cb9$6@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28265&group=comp.lang.c#28265

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 19:20:47 +0200
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <ucg0lf$18cb9$6@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me>
<efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com>
<873505pdw0.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 27 Aug 2023 17:20:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="09710c0d7f4cb120cf61093dd0f1580b";
logging-data="1323369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/upo+8NrfdO4wdUf1/v4GLgUYUzH+Sgw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:Y+WCzL/VlD3okA5gAI9g/NesaJg=
Content-Language: en-GB
In-Reply-To: <873505pdw0.fsf@bsb.me.uk>
 by: David Brown - Sun, 27 Aug 2023 17:20 UTC

On 27/08/2023 01:44, Ben Bacarisse wrote:
>
> As it happens, I am not with David on this. There are many matters on
> which I think an appeal to authority carries significant weight. I
> don't know DMR's opinion of underscores (the code in K&R is indicative
> but not exactly conclusive), but I would take more time considering it
> than I would Kevin's or Barbara's. It's just one way to simplify life.

Ah, now it is /your/ turn to misunderstand the "appeal to authority"
fallacy - or at least, to Malcolm's use of it or my objection to his use.

It's fine to "appeal to authority" as supporting evidence for a claim,
and it is absolutely appropriate to view DMR's opinion on C style in
higher standing than Kevin's or Barbara's.

But it is fallacious to think of DMR's opinion as being proof that
Malcolm's theories are correct - at best, they could be supporting
evidence. (Even experts are wrong sometimes.) It is fallacious to
appeal to DMR's authority when his coding and writing don't actually
support Malcolm's ideas at all. It is fallacious to cherry-pick bits of
code that appear to support it, rather than looking at a wider selection
of his code. It is fallacious to consider his code written in different
circumstances than code written now (his tools had very limited lengths
of significant characters in identifiers).

There's nothing wrong with using expert or authority opinion to bolster
an argument, when it is not fallacious.

Re: C vs Haskell for XML parsing

<ucg420$19crf$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28266&group=comp.lang.c#28266

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.com (Richard Harnden)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 19:18:39 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ucg420$19crf$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me>
Reply-To: nospam.harnden@gmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 27 Aug 2023 18:18:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="eda11b3c859b60e42d8140d09a563a95";
logging-data="1356655"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RNVjpbBBb2yVHtbDmrCHcqYI6fS0F3Ys="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.14.0
Cancel-Lock: sha1:e0vi/kAYACMgPcyCJipxtrmObKk=
In-Reply-To: <ucfusp$18cb9$3@dont-email.me>
 by: Richard Harnden - Sun, 27 Aug 2023 18:18 UTC

On 27/08/2023 17:50, David Brown wrote:

[about named parameters]

>
> You can have both "void foo(int a, int b);" and "void foo(int b, int
> a);" declarations visible at the same time.

The function is 'void foo(int, int)' ... the a and b tags are supposed
to be self-documenting.

>
> And if one translation unit defined "void foo(int a, int b);", while
> another declared "void foo(int b, int a);" and used that with named
> parameters, you would not get the correct call.

You'd need something like: void foo(int a:x, int b:y);

where the parameter names are x and y (and a and b don't really matter).

All that buys you is the ability to call foo with the paramaters
out-of-order:
foo(y:100, x:5); // foo(5, 100);

And I don't think it really gains you anything.

But ... default values, maybe that would be more useful?

void foo(int a:x, int b:y:5);
void bar(int a:x, int b:y:5, int c:z:2);

So you could say:
foo(100); // foo(100, 5);
foo(y:1); // error - no default for x
bar(100, z:4); // bar(100, 5, 4);
bar(z:4, y:1, x:20); // bar(20, 1, 4);

Re: C vs Haskell for XML parsing

<ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28267&group=comp.lang.c#28267

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ad4:4a71:0:b0:63c:ec39:1405 with SMTP id cn17-20020ad44a71000000b0063cec391405mr705191qvb.5.1693160328512;
Sun, 27 Aug 2023 11:18:48 -0700 (PDT)
X-Received: by 2002:a05:6214:1633:b0:640:116e:d176 with SMTP id
e19-20020a056214163300b00640116ed176mr730721qvw.3.1693160328297; Sun, 27 Aug
2023 11:18:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 27 Aug 2023 11:18:48 -0700 (PDT)
In-Reply-To: <ucg0lf$18cb9$6@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:49ab:6c76:d8de:136a;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:49ab:6c76:d8de:136a
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me> <e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me> <b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me> <d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me> <d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me> <1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me> <81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me> <8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com>
<873505pdw0.fsf@bsb.me.uk> <ucg0lf$18cb9$6@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Sun, 27 Aug 2023 18:18:48 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 5499
 by: Malcolm McLean - Sun, 27 Aug 2023 18:18 UTC

On Sunday, 27 August 2023 at 18:21:00 UTC+1, David Brown wrote:
> On 27/08/2023 01:44, Ben Bacarisse wrote:
> >
> > As it happens, I am not with David on this. There are many matters on
> > which I think an appeal to authority carries significant weight. I
> > don't know DMR's opinion of underscores (the code in K&R is indicative
> > but not exactly conclusive), but I would take more time considering it
> > than I would Kevin's or Barbara's. It's just one way to simplify life.
> Ah, now it is /your/ turn to misunderstand the "appeal to authority"
> fallacy - or at least, to Malcolm's use of it or my objection to his use.
>
> It's fine to "appeal to authority" as supporting evidence for a claim,
> and it is absolutely appropriate to view DMR's opinion on C style in
> higher standing than Kevin's or Barbara's.
>
> But it is fallacious to think of DMR's opinion as being proof that
> Malcolm's theories are correct - at best, they could be supporting
> evidence. (Even experts are wrong sometimes.) It is fallacious to
> appeal to DMR's authority when his coding and writing don't actually
> support Malcolm's ideas at all. It is fallacious to cherry-pick bits of
> code that appear to support it, rather than looking at a wider selection
> of his code. It is fallacious to consider his code written in different
> circumstances than code written now (his tools had very limited lengths
> of significant characters in identifiers).
>
> There's nothing wrong with using expert or authority opinion to bolster
> an argument, when it is not fallacious.
>
No. Denis Ritchie didn't like const. But to say "const is a bad idea because
Denis Ritchie didn't support it" is fallacious, though obvioulsy Denis Ritchie
almost certainly knows what he is talking about, and obvioulsy the committee
has shown their inferiority inm many other ways. But you have to look at the
arguments Ritchie used, not just say "Ritchie says so, so it is".

However identifers are a. bit different. Ritchie was no expert on Colas. But,
as I said, if he said "Coke is nicer than Pepsi" then that makes it true that
Coke is nicer than Pepsi, for him. And it is a counter-example to the claim
that everyone prefers Pepsi.

Ritchie used identifiers without spaces to separate the words. So that disproves
the claim that everyone agree that this style is wrong. And of course because
he is a familiar and well respected figure, he's a good counterexampe to choose.
But I also gave Caesar as a counter-example, and of course no-one would say
that Caesar was an authority on C. But Ceasar is someone everyone would have
heard of. God also gave His Torah to the Jewish people, without spaces.

So on my side, Caesar, Denis Ritchie, and God. That's clearly no "no-one". Whilst
had I offered Kevin and Barbara from the office I could be accused of trawling
through a vast bank of people to cherry pick

But the actual argument from Denis Ritchie was a bit different.. Calls to the
standard library are very common in C code. And Ritchie chose the names of
the standard library functions. So, since he agreed with my style, where a standard
library function consists of two English words, they are not separated by an underscore.
Now consistency is important, and Denis Ritchie, as the author of C, set the C "house style".

Re: C vs Haskell for XML parsing

<ucg4uo$19fkm$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28268&group=comp.lang.c#28268

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 18:34:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Sender: <untosten@0.0.0.0>
Message-ID: <ucg4uo$19fkm$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <uca3sh$p9c$1@dont-email.me> <efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com> <873505pdw0.fsf@bsb.me.uk> <ucg0lf$18cb9$6@dont-email.me> <ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>
Injection-Date: Sun, 27 Aug 2023 18:34:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5835c019b6957477c1c45bdaee6ae095";
logging-data="1359510"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oYL6hEclZhe6ehta0f/Q7kG5XtKlzwdo="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.4.11-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:eGllWzzm4Hfcdj1bfXS07yx9czg=
 by: Kalevi Kolttonen - Sun, 27 Aug 2023 18:34 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
> No. Denis Ritchie didn't like const. But to say "const is a bad idea because
> Denis Ritchie didn't support it" is fallacious, though obvioulsy Denis Ritchie
> almost certainly knows what he is talking about, and obvioulsy the committee
> has shown their inferiority inm many other ways. But you have to look at the
> arguments Ritchie used, not just say "Ritchie says so, so it is".

I am sorry, I am a bit lazy today and cannot be bothered to do web
searches. What exactly are Ritchie's arguments against "const"?

I cannot think of any, but I have heard some that lend support
to having, and properly using, "const".

br,
KK

Re: C vs Haskell for XML parsing

<ucg7jl$19tgt$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28271&group=comp.lang.c#28271

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 21:19:17 +0200
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <ucg7jl$19tgt$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me> <ucg420$19crf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 27 Aug 2023 19:19:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b1a4d682b432ff4d5e0105043cec5a4d";
logging-data="1373725"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ek9mTdBwml6elICUx07hEay2tDxMCBdo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:bOaqHnpYWKCaEuBEJRZzX09c8XM=
Content-Language: en-GB
In-Reply-To: <ucg420$19crf$1@dont-email.me>
 by: David Brown - Sun, 27 Aug 2023 19:19 UTC

On 27/08/2023 20:18, Richard Harnden wrote:
> On 27/08/2023 17:50, David Brown wrote:
>
> [about named parameters]
>
>>
>> You can have both "void foo(int a, int b);" and "void foo(int b, int
>> a);" declarations visible at the same time.
>
> The function is 'void foo(int, int)' ... the a and b tags are supposed
> to be self-documenting.
>
>>
>> And if one translation unit defined "void foo(int a, int b);", while
>> another declared "void foo(int b, int a);" and used that with named
>> parameters, you would not get the correct call.
>
> You'd need something like: void foo(int a:x, int b:y);
>
> where the parameter names are x and y (and a and b don't really matter).

Why would you want two names here? You want the parameters to have a
single name each (which should be, as you say, self-documenting).

>
> All that buys you is the ability to call foo with the paramaters
> out-of-order:
>     foo(y:100, x:5); // foo(5, 100);
>
> And I don't think it really gains you anything.

The real gain comes from not using them out-of-order by mistake. If
"foo" is defined as "void foo(int x, int y)" and you write :

foo(y : 100, x : 5)

then it could either be counted as "foo(5, 100)", or it could be flagged
as an error. I wouldn't mind it being an error, and having to write
"foo(x : 5, y : 100)" - that would help keep the source code consistent.
The key point is that you don't write "foo(100, 5)" thinking
mistakenly that foo was defined as "foo(int y, int x)".

So for me at least, the biggest benefit of named parameters is to catch
potential errors. User convenience at the call site is secondary.

>
> But ... default values, maybe that would be more useful?
>
> void foo(int a:x, int b:y:5);
> void bar(int a:x, int b:y:5, int c:z:2);
>
> So you could say:
>     foo(100); // foo(100, 5);
>     foo(y:1); // error - no default for x
>     bar(100, z:4); // bar(100, 5, 4);
>     bar(z:4, y:1, x:20); // bar(20, 1, 4);
>
>

I'm not so convinced about default values. They can be handy (in
languages that support them) when adding new parameters to existing
functions, but are not necessarily a great idea. There is a school of
thought in C++ that instead of declaring "void foo(int x, int y = 1)"
you should declare two functions - "void foo(int x)" and "void foo(int
x, int y)" - where "void foo(int x)" calls "foo(x, 1)". Some people
feel it gives you more control - you can differentiate between leaving
out the argument and coincidentally picking the default value.

Re: C vs Haskell for XML parsing

<ucg8f7$1a528$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28272&group=comp.lang.c#28272

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 20:33:59 +0100
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <ucg8f7$1a528$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me> <ucg420$19crf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 27 Aug 2023 19:33:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="eaa89527a9afde9f88ac0dab313b2a1e";
logging-data="1381448"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FhoGRhxkx7dLZ/M/Jk5uvQqOfbaLSh1Y="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:9Fkab2EJTtG//naawdeu14tLpCM=
In-Reply-To: <ucg420$19crf$1@dont-email.me>
 by: Bart - Sun, 27 Aug 2023 19:33 UTC

On 27/08/2023 19:18, Richard Harnden wrote:
> On 27/08/2023 17:50, David Brown wrote:
>
> [about named parameters]
>
>>
>> You can have both "void foo(int a, int b);" and "void foo(int b, int
>> a);" declarations visible at the same time.
>
> The function is 'void foo(int, int)' ... the a and b tags are supposed
> to be self-documenting.
>
>>
>> And if one translation unit defined "void foo(int a, int b);", while
>> another declared "void foo(int b, int a);" and used that with named
>> parameters, you would not get the correct call.
>
> You'd need something like: void foo(int a:x, int b:y);
>
> where the parameter names are x and y (and a and b don't really matter).

I don't understand: what are 'a' and 'b' for then? If both lots of names
are used, then let them be alternatives:

int count_e(int FS, char* filename:string) {...}

When FS is 'F' the second parameter represents a filename; when 'S', it
is a string containing the data. Those two uses can be given more apt names:

count_e('F', filename:"input.txt");
count_e('S', string:"This is some literal text");

> All that buys you is the ability to call foo with the paramaters
> out-of-order:
>     foo(y:100, x:5); // foo(5, 100);
>
> And I don't think it really gains you anything.

It helps to document the meaning of each argument in calls like 'f(1, 0,
1, 1)'.

It avoids having to remember the order of the arguments (but you need to
remember the parameter names).

It allows the parameter ordering to be changed without affecting
call-sites (but only if positional arguments are used).

> But ... default values, maybe that would be more useful?

With those it will be considerably more useful. They are useful also on
their own. For example, start with this:

int F(int a, int b);

Write 1000s of lines of code with instances of F(x,y). Then you decide
that sometimes, an extra parameter is needed (or this could even be
temporary to help debugging). Make that extra parameter optional:

int F(int a, int b, int newflag=0);

'=0' is my syntax for a default value. Like this, existing code will
compile unchanged, and will pass newflag as 0. Only new code that needs
to use that flag need to supply that new argument.

> void foo(int a:x, int b:y:5);
> void bar(int a:x, int b:y:5, int c:z:2);

A rather strange syntax though.

> So you could say:
>     foo(100); // foo(100, 5);
>     foo(y:1); // error - no default for x
>     bar(100, z:4); // bar(100, 5, 4);
>     bar(z:4, y:1, x:20); // bar(20, 1, 4);

Re: C vs Haskell for XML parsing

<ucg9ou$1a678$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28273&group=comp.lang.c#28273

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 15:56:14 -0400
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <ucg9ou$1a678$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<87h6onfje9.fsf@nosuchdomain.example.com>
<66653005-66fa-4a89-8b1f-0b415fb7e8ean@googlegroups.com>
<yJnGM.142651$ftCb.40495@fx34.iad>
<03a4b2f0-92a7-4652-86f6-66f7d5cf8853n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 27 Aug 2023 19:56:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="88eb41af0b1f78f8f91c3fb2616e522b";
logging-data="1382632"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+d2ZkatGo7DSCVNPfTtzuE87EQp04T7yg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:gCZo539KHGL5RubJE0pDToHK+H4=
In-Reply-To: <03a4b2f0-92a7-4652-86f6-66f7d5cf8853n@googlegroups.com>
Content-Language: en-US
 by: James Kuyper - Sun, 27 Aug 2023 19:56 UTC

On 27/08/2023 07:54, Malcolm McLean wrote:
> On Saturday, 26 August 2023 at 15:10:54 UTC+1, Scott Lurndal wrote:
....
>> The sources I found indicate that it wasn't intended to be read by anyone
>> other than the person who wrote it.
>>
> Just goes to show that you can believe everything you read.
> Do you think that is remotely plausible?

The Wikipedia article on Scriptio Continua gives precisely that
explanation. That explanation is bracketed by two citations - it's not
clear which of the two is most relevant:

Moore, F. C. T. (2001). "Scribes and Texts: A Test Case for Models of
Cultural Transmission". The Monist. 84 (3): 421.
doi:10.5840/monist200184325. JSTOR 27903738. Retrieved March 24, 2023.

Parkes, M. B. "Antiquity: Aids for Inexperienced Readers and the
Prehistory of Punctuation". Pause and Effect: An Introduction to the
History of Punctuation in the West. Berkeley: U of California, 1993. 10–11.

I would not recommend dismissing that thesis out of hand without first
following up on those citations and learning what reasons they give for
believing it to be true.

Re: C vs Haskell for XML parsing

<87pm38cihm.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28275&group=comp.lang.c#28275

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 13:56:05 -0700
Organization: None to speak of
Lines: 47
Message-ID: <87pm38cihm.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="f59bf797c486742749b57ed64aff336a";
logging-data="1403562"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1C3/cCVjkuC51Yd/UyK6C"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:YawI2FZh3D+sF6zHS/NGWXlGrbU=
sha1:F6UYdsDzOYuwGIahaxHG2a9ULDs=
 by: Keith Thompson - Sun, 27 Aug 2023 20:56 UTC

David Brown <david.brown@hesbynett.no> writes:
> On 25/08/2023 20:59, Keith Thompson wrote:
>> David Brown <david.brown@hesbynett.no> writes:
[...]
>>> Any resolution here would place restrictions on which functions could
>>> support named parameters - such as consistent declarations and
>>> definitions, but it would be impossible (in general) to check them.
>>
>> Any parameter names in a call would just have to be consistent with
>> the names in the visible prototype. I don't see a problem.
>
> You can have both "void foo(int a, int b);" and "void foo(int b, int
> a);" declarations visible at the same time.

So have a rule that the most recent declaration applies. If you write
two declarations with deliberately misleading parameter names, you get
what you deserve.

> And if one translation unit defined "void foo(int a, int b);", while
> another declared "void foo(int b, int a);" and used that with named
> parameters, you would not get the correct call.

True. So don't do that.

> If you required the compiler to enforce that all declarations and
> definitions of a function used the same parameter names, then you'd do
> much better. (There is still scope for errors, but would be basically
> the same as we have today for calling functions with incorrect numbers
> or types of arguments.) But that would conflict with existing code
> that was valid before.

I might have advocated requiring parameter names to be consistent
(basically making parameter names as well as their types, part of the
function signature), but it's too late for that.

> So you'd need a new syntax to say that a function must have all its
> declarations having consistent parameter names. You'd have to write
> "void foo(int a static, int b static);" !

No, I don't think you do.

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: C vs Haskell for XML parsing

<87il90chmj.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28276&group=comp.lang.c#28276

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 14:14:44 -0700
Organization: None to speak of
Lines: 43
Message-ID: <87il90chmj.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me> <ucg420$19crf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="f59bf797c486742749b57ed64aff336a";
logging-data="1413468"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8aa1TPPmTnZkqy3b+MH2+"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:LazcqeVHHQJu7rwfeEMmy3grZWo=
sha1:mT/m5h4e3DdM04sr3XxsH2LWwzg=
 by: Keith Thompson - Sun, 27 Aug 2023 21:14 UTC

Richard Harnden <richard.nospam@gmail.com> writes:
> On 27/08/2023 17:50, David Brown wrote:
> [about named parameters]
>
>> You can have both "void foo(int a, int b);" and "void foo(int b, int
>> a);" declarations visible at the same time.
>
> The function is 'void foo(int, int)' ... the a and b tags are supposed
> to be self-documenting.
>
>> And if one translation unit defined "void foo(int a, int b);", while
>> another declared "void foo(int b, int a);" and used that with named
>> parameters, you would not get the correct call.
>
> You'd need something like: void foo(int a:x, int b:y);
>
> where the parameter names are x and y (and a and b don't really matter).

Why? What's the point of having two names for the same parameter?

> All that buys you is the ability to call foo with the paramaters
> out-of-order:
> foo(y:100, x:5); // foo(5, 100);
>
> And I don't think it really gains you anything.

The main point is letting calls be more self-documenting. (Names like
a, b, x, and y don't illustrate that very well.)

I think this was triggered by bool parameters, where you could have a
call like:
func(blah, true, true, false);
A reader can't tell what "true, true, false" means without being *very*
familiar with func()'s signature. With named arguments, you could write
that as:
func(blah, text_mode: true, highlight: true, color: false);

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: C vs Haskell for XML parsing

<20230827151627.814@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28277&group=comp.lang.c#28277

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 22:45:51 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 143
Message-ID: <20230827151627.814@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
Injection-Date: Sun, 27 Aug 2023 22:45:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="10c6d898fd3a93281822b96d674293f3";
logging-data="1439319"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+X2SjmkF/NgOTCVg43cSfmCKesfLgp6B0="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:r1c6D2mIsRFCEQ+1ItRQ4D/gAMo=
 by: Kaz Kylheku - Sun, 27 Aug 2023 22:45 UTC

On 2023-08-27, Bart <bc@freeuk.com> wrote:
> On 27/08/2023 05:24, Kaz Kylheku wrote:
>> On 2023-08-26, Bart <bc@freeuk.com> wrote:
>>> With the feature in place, people can create their own wrapper functions
>>> and make their own choices.
>>
>> Yikes; just what we need: people scrambling the order of arguments
>> to standard functions, using their own local names.
>>
>> Quick, which one is the destination?
>>
>> strcpy(goat: userid, fish: uid);
>>
>
> That's an excellent idea, I've just changed my FFI strcpy, which hadn't
> had parameter names up to now, to this:
>
> func strcpy(ichar goat, fish="<Insert string here>")ichar
>
> Now I can write:
>
> strcpy(fish:"Hello", goat:str)
>
> or even just:
>
> strcpy(str)
>
> Silly, but at least I can do it. The more useful, non-silly applications
> outnumber the silly ones.
>
> Remember that C's macro processor can do a LOT worse:
>
> #define int float
>
> #define while if

This argument is like: crack can do worse, so just give the kids
cigarettes.

If required, positional parameters are going to be callable using named
arguments, the named arguments must be a mandatory part of the function
definition.

A redeclaration with different names must be diagnosable error.

In the case of C structures, names count for compatibility.

Two structure types that are structurally identical, occurring in
different translation units must have the same member names, in the
same order, in order to be considered compatible.

The only way this can be sanely introduced into C with backward
compatibility is if there is a separate way to introduce the
parameter names used for named calling, like this:

char *strcpy(const char * : dest, char * : src);

THe syntax for the declaread identifier in a function declaration
would be:

ident_opt
| ident ':' ident_opt
| ':' ident
| /* nothing */

The identifier after the ':' is available for specifying named
arguments. Only functions which are declared this way support
named arguments.

If at least one parameter of a function declaration uses the
above ':' syntax, then all parameters implicitly have argument
names, even without ussing ':'.

When only the ':' is given, not followed by an identifier,
then that specifies a named argument which inherits the parameter
name: foo : is the same as foo : foo.

If a parameter is asssociated with an argument name implicitly,
without the use of the : syntax above, because some other
parameter uses the : syntax, then the argument name is
the same as the parameter name, as if : were given followed
by nothing or by a repetition of the parameter name.

Constraints:

- The argument names need not be the same as the parameter names,
but must be unique among themselves.

- An argument name associated with a parameter may be the same
as that parameter name; but must not be the same as any other
parameter name.

- If a declaration of a function uses argument names, all other
declarations of the function must use argument names, and the
names must be the same. The parameter names need not be.

Implementations could support a macro to enable names, like

#define __stdc_argument_names 1

Inside a header, it could be like:

#if __stdc_argument_names
#define __aname(x) : x
#else
#define __aname(x)
#endif

Then strcpy would look like:

char *strcpy(char *__dst __aname(dst),
const char *__src __aname(src));

If the application enables __stdc_argument_names, then it
can no longer do this:

#define __stdc_argument_names 1
#include <string.h>

// Error: non-arg-name declaration follows arg-name
char *strcpy(char *destination, const char *source);

It must ensure that there are argument names which match
the standard-given ones:

// Explicitly given: param names can be arbitrary
char *strcpy(char *foo : dst, const char *bar : src);

// Explicitly given: param names omitted

char *strcpy(char * : st, const char * : src);

// Implicitly derived from param names
char *strcpy(char *dst :, const char *src);

// Error, wrong names
char *strcpy(char *src :, const char *dst);

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

Re: C vs Haskell for XML parsing

<kGQGM.834420$TPw2.617635@fx17.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28278&group=comp.lang.c#28278

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: C vs Haskell for XML parsing
Content-Language: en-US
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com>
From: Rich...@Damon-Family.org (Richard Damon)
In-Reply-To: <20230827151627.814@kylheku.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 161
Message-ID: <kGQGM.834420$TPw2.617635@fx17.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Sun, 27 Aug 2023 19:06:56 -0400
X-Received-Bytes: 6898
 by: Richard Damon - Sun, 27 Aug 2023 23:06 UTC

On 8/27/23 6:45 PM, Kaz Kylheku wrote:
> On 2023-08-27, Bart <bc@freeuk.com> wrote:
>> On 27/08/2023 05:24, Kaz Kylheku wrote:
>>> On 2023-08-26, Bart <bc@freeuk.com> wrote:
>>>> With the feature in place, people can create their own wrapper functions
>>>> and make their own choices.
>>>
>>> Yikes; just what we need: people scrambling the order of arguments
>>> to standard functions, using their own local names.
>>>
>>> Quick, which one is the destination?
>>>
>>> strcpy(goat: userid, fish: uid);
>>>
>>
>> That's an excellent idea, I've just changed my FFI strcpy, which hadn't
>> had parameter names up to now, to this:
>>
>> func strcpy(ichar goat, fish="<Insert string here>")ichar
>>
>> Now I can write:
>>
>> strcpy(fish:"Hello", goat:str)
>>
>> or even just:
>>
>> strcpy(str)
>>
>> Silly, but at least I can do it. The more useful, non-silly applications
>> outnumber the silly ones.
>>
>> Remember that C's macro processor can do a LOT worse:
>>
>> #define int float
>>
>> #define while if
>
> This argument is like: crack can do worse, so just give the kids
> cigarettes.
>
> If required, positional parameters are going to be callable using named
> arguments, the named arguments must be a mandatory part of the function
> definition.
>
> A redeclaration with different names must be diagnosable error.

No, that would be a very backwards breaking change.

changing names might make the function not callable with named
parameters, but only "old style" with just values listed.

>
> In the case of C structures, names count for compatibility.
>
> Two structure types that are structurally identical, occurring in
> different translation units must have the same member names, in the
> same order, in order to be considered compatible.

Why? what difference can that make to the actual code generted?

In C, the structures don't even need the same type name to be compatible.

Again, that becomes a breaking change, and one that actually takes a lot
of work to actually detect the error to give a diagnostic.

>
> The only way this can be sanely introduced into C with backward
> compatibility is if there is a separate way to introduce the
> parameter names used for named calling, like this:
>
>
> char *strcpy(const char * : dest, char * : src);

That is one option to make named parameter calls optional.

If you do that, THEN you can make not match an error.

>
> THe syntax for the declaread identifier in a function declaration
> would be:
>
> ident_opt
> | ident ':' ident_opt
> | ':' ident
> | /* nothing */
>
> The identifier after the ':' is available for specifying named
> arguments. Only functions which are declared this way support
> named arguments.
>
> If at least one parameter of a function declaration uses the
> above ':' syntax, then all parameters implicitly have argument
> names, even without ussing ':'.
>
> When only the ':' is given, not followed by an identifier,
> then that specifies a named argument which inherits the parameter
> name: foo : is the same as foo : foo.
>
> If a parameter is asssociated with an argument name implicitly,
> without the use of the : syntax above, because some other
> parameter uses the : syntax, then the argument name is
> the same as the parameter name, as if : were given followed
> by nothing or by a repetition of the parameter name.
>
> Constraints:
>
> - The argument names need not be the same as the parameter names,
> but must be unique among themselves.
>
> - An argument name associated with a parameter may be the same
> as that parameter name; but must not be the same as any other
> parameter name.
>
> - If a declaration of a function uses argument names, all other
> declarations of the function must use argument names, and the
> names must be the same. The parameter names need not be.
>
> Implementations could support a macro to enable names, like
>
> #define __stdc_argument_names 1
>
> Inside a header, it could be like:
>
> #if __stdc_argument_names
> #define __aname(x) : x
> #else
> #define __aname(x)
> #endif
>
> Then strcpy would look like:
>
> char *strcpy(char *__dst __aname(dst),
> const char *__src __aname(src));
>
> If the application enables __stdc_argument_names, then it
> can no longer do this:
>
> #define __stdc_argument_names 1
> #include <string.h>
>
> // Error: non-arg-name declaration follows arg-name
> char *strcpy(char *destination, const char *source);
>
> It must ensure that there are argument names which match
> the standard-given ones:
>
> // Explicitly given: param names can be arbitrary
> char *strcpy(char *foo : dst, const char *bar : src);
>
> // Explicitly given: param names omitted
>
> char *strcpy(char * : st, const char * : src);
>
> // Implicitly derived from param names
> char *strcpy(char *dst :, const char *src);
>
> // Error, wrong names
> char *strcpy(char *src :, const char *dst);
>

Re: C vs Haskell for XML parsing

<87edjocbqj.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28279&group=comp.lang.c#28279

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 16:21:56 -0700
Organization: None to speak of
Lines: 41
Message-ID: <87edjocbqj.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="bc514d5855dc6fc2634690c4c79f2ba3";
logging-data="1449505"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19C7xP1kwI4uRucJkl9bjYF"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:t9ORhdN12xK93SaoN3/nVMMwxrs=
sha1:f/ZjsInNXE2URr15f9fF9yCer6Q=
 by: Keith Thompson - Sun, 27 Aug 2023 23:21 UTC

Kaz Kylheku <864-117-4973@kylheku.com> writes:
[...]
> If required, positional parameters are going to be callable using named
> arguments, the named arguments must be a mandatory part of the function
> definition.

Named arguments are already mandatory for function definitions (barring
old-style definitions).

I don't think it's practical to make them mandatory for function
declarations. That would break tons of existing code.

My suggestion: If a function declaration doesn't use parameter names,
you can't call it with named arguments. (You can always write your own
declaration for an existing function.)

> A redeclaration with different names must be diagnosable error.

That would break existing code. My suggestion: the names in the *last*
visible declaration before a call can be used in a call. (Strongly
suggested best practice would be to use consistent names.)

[...]

> The only way this can be sanely introduced into C with backward
> compatibility is if there is a separate way to introduce the
> parameter names used for named calling, like this:
>
> char *strcpy(const char * : dest, char * : src);

Why not just declare
char *strcpy(const char *dest, char *src);
and use those names in calls, with a few simple rules for when there's
more than one visible declaration?

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: C vs Haskell for XML parsing

<87y1hwm3xg.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28280&group=comp.lang.c#28280

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 01:00:27 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <87y1hwm3xg.fsf@bsb.me.uk>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me>
<efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com>
<873505pdw0.fsf@bsb.me.uk> <ucg0lf$18cb9$6@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1c35b718727ecba87d6437feb1cbcad9";
logging-data="1456117"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ILTUGXMabV8MeVsXA4jiynjTG+DL4aA0="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:J4aWWBN7j8QVdRcOXpXRzeq4CyI=
sha1:UlXIS4CTsW9foNPEIfLupmKzQYI=
X-BSB-Auth: 1.7414822eafdbb0614004.20230828010027BST.87y1hwm3xg.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 28 Aug 2023 00:00 UTC

David Brown <david.brown@hesbynett.no> writes:

> On 27/08/2023 01:44, Ben Bacarisse wrote:
>> As it happens, I am not with David on this. There are many matters on
>> which I think an appeal to authority carries significant weight. I
>> don't know DMR's opinion of underscores (the code in K&R is indicative
>> but not exactly conclusive), but I would take more time considering it
>> than I would Kevin's or Barbara's. It's just one way to simplify life.
>
> Ah, now it is /your/ turn to misunderstand the "appeal to authority"
> fallacy - or at least, to Malcolm's use of it or my objection to his
> use.

I did not refer to any supposed fallacy.

> It's fine to "appeal to authority" as supporting evidence for a claim, and
> it is absolutely appropriate to view DMR's opinion on C style in higher
> standing than Kevin's or Barbara's.

That is all I was referring to and all I was commenting on in MM's post.

> But it is fallacious to think of DMR's opinion as being proof that
> Malcolm's theories are correct - at best, they could be supporting
> evidence.

Maybe you went further and were suggesting that he was constructing a
logical argument based on the appeal to authority. If so, I missed
that. I didn't think he was doing that.

--
Ben.

Re: C vs Haskell for XML parsing

<20230827165554.489@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28281&group=comp.lang.c#28281

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 00:00:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20230827165554.489@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
Injection-Date: Mon, 28 Aug 2023 00:00:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="10c6d898fd3a93281822b96d674293f3";
logging-data="1455871"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/BsKy+SnP2Q3vCzQGvg6cTyuRWvp9tlhs="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:CEE3HXDZD6r5wp//mI7yrh+n0dI=
 by: Kaz Kylheku - Mon, 28 Aug 2023 00:00 UTC

On 2023-08-27, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Kaz Kylheku <864-117-4973@kylheku.com> writes:
> [...]
>> The only way this can be sanely introduced into C with backward
>> compatibility is if there is a separate way to introduce the
>> parameter names used for named calling, like this:
>
>> char *strcpy(const char * : dest, char * : src);
>
> Why not just declare
> char *strcpy(const char *dest, char *src);
> and use those names in calls, with a few simple rules for when there's
> more than one visible declaration?

In order to prevent

#include <string.h>

// someone adds this somewhere, and arguments get flipped
// downscope of it.
char *strcpy(char *src, const char *dest);

If we are going to have argument names that have a semantic
purpose, I'd like those to be part of the declaration.

If the standard declaration has been included via the proper header, the
program should be defended against an incorrect declaration coming from
somewhere else.

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

Re: C vs Haskell for XML parsing

<ucgptp$1coeu$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28282&group=comp.lang.c#28282

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 01:31:52 +0100
Organization: A noiseless patient Spider
Lines: 154
Message-ID: <ucgptp$1coeu$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Aug 2023 00:31:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="144ee3818d970517c8b3d421959835fd";
logging-data="1466846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oiaBZDQBjsW9lJYramCwbQ5yQjdKzSOI="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:Ghmps/5OLgjiXIO0eDsb9ro8b54=
In-Reply-To: <20230827151627.814@kylheku.com>
 by: Bart - Mon, 28 Aug 2023 00:31 UTC

On 27/08/2023 23:45, Kaz Kylheku wrote:
> On 2023-08-27, Bart <bc@freeuk.com> wrote:
>> On 27/08/2023 05:24, Kaz Kylheku wrote:
>>> On 2023-08-26, Bart <bc@freeuk.com> wrote:
>>>> With the feature in place, people can create their own wrapper functions
>>>> and make their own choices.
>>>
>>> Yikes; just what we need: people scrambling the order of arguments
>>> to standard functions, using their own local names.
>>>
>>> Quick, which one is the destination?
>>>
>>> strcpy(goat: userid, fish: uid);
>>>
>>
>> That's an excellent idea, I've just changed my FFI strcpy, which hadn't
>> had parameter names up to now, to this:
>>
>> func strcpy(ichar goat, fish="<Insert string here>")ichar
>>
>> Now I can write:
>>
>> strcpy(fish:"Hello", goat:str)
>>
>> or even just:
>>
>> strcpy(str)
>>
>> Silly, but at least I can do it. The more useful, non-silly applications
>> outnumber the silly ones.
>>
>> Remember that C's macro processor can do a LOT worse:
>>
>> #define int float
>>
>> #define while if
>
> This argument is like: crack can do worse, so just give the kids
> cigarettes.

The argument is more like: kids can already legally buy crack, but let's
stop them buying cigarettes. (Which I believe would actually be a safer
habit.)

> The only way this can be sanely introduced into C with backward
> compatibility is if there is a separate way to introduce the
> parameter names used for named calling, like this:
>
>
> char *strcpy(const char * : dest, char * : src);
>
> THe syntax for the declaread identifier in a function declaration
> would be:
>
> ident_opt
> | ident ':' ident_opt
> | ':' ident
> | /* nothing */
>
> The identifier after the ':' is available for specifying named
> arguments. Only functions which are declared this way support
> named arguments.

So what goes inside a function definition? Do you have to write this:

char *strcpy(const char * dest : dest, char * src : src);

Or will all existing definitions need to end up as:

char *strcpy(const char * : dest, char * : src);

with the extra colon? If so, will these identifiers also serve as naming
the parameters for use inside the function?

Could somebody do this:

char *strcpy(const char * dest : src, char * src : dest);

> If at least one parameter of a function declaration uses the
> above ':' syntax, then all parameters implicitly have argument
> names, even without ussing ':'.

> When only the ':' is given, not followed by an identifier,
> then that specifies a named argument which inherits the parameter
> name: foo : is the same as foo : foo.

Sorry, too complicated.

> If a parameter is asssociated with an argument name implicitly,
> without the use of the : syntax above, because some other
> parameter uses the : syntax, then the argument name is
> the same as the parameter name, as if : were given followed
> by nothing or by a repetition of the parameter name.
>
> Constraints:
>
> - The argument names need not be the same as the parameter names,
> but must be unique among themselves.
>
> - An argument name associated with a parameter may be the same
> as that parameter name; but must not be the same as any other
> parameter name.
>
> - If a declaration of a function uses argument names, all other
> declarations of the function must use argument names, and the
> names must be the same. The parameter names need not be.
>
> Implementations could support a macro to enable names, like
>
> #define __stdc_argument_names 1
>
> Inside a header, it could be like:
>
> #if __stdc_argument_names
> #define __aname(x) : x
> #else
> #define __aname(x)
> #endif
>
> Then strcpy would look like:
>
> char *strcpy(char *__dst __aname(dst),
> const char *__src __aname(src));
>
> If the application enables __stdc_argument_names, then it
> can no longer do this:
>
> #define __stdc_argument_names 1
> #include <string.h>
>
> // Error: non-arg-name declaration follows arg-name
> char *strcpy(char *destination, const char *source);
>
> It must ensure that there are argument names which match
> the standard-given ones:
>
> // Explicitly given: param names can be arbitrary
> char *strcpy(char *foo : dst, const char *bar : src);
>
> // Explicitly given: param names omitted
>
> char *strcpy(char * : st, const char * : src);
>
> // Implicitly derived from param names
> char *strcpy(char *dst :, const char *src);
>
> // Error, wrong names
> char *strcpy(char *src :, const char *dst);
>

Yep. That's good way to ensure nobody will use the feature. It needs to
simple to understand and use.

Re: C vs Haskell for XML parsing

<87a5ubdhb2.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28283&group=comp.lang.c#28283

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sun, 27 Aug 2023 19:36:17 -0700
Organization: None to speak of
Lines: 45
Message-ID: <87a5ubdhb2.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com>
<87edjocbqj.fsf@nosuchdomain.example.com>
<20230827165554.489@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="bc514d5855dc6fc2634690c4c79f2ba3";
logging-data="1620404"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9MNZK2exaCy8YyW57L+UB"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:pME8RTuBxNqE2k3Oyw1iittUfNE=
sha1:C+WhwciSW/RDC19xlSHeF9ZrbNw=
 by: Keith Thompson - Mon, 28 Aug 2023 02:36 UTC

Kaz Kylheku <864-117-4973@kylheku.com> writes:
> On 2023-08-27, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>> [...]
>>> The only way this can be sanely introduced into C with backward
>>> compatibility is if there is a separate way to introduce the
>>> parameter names used for named calling, like this:
>>
>>> char *strcpy(const char * : dest, char * : src);
>>
>> Why not just declare
>> char *strcpy(const char *dest, char *src);
>> and use those names in calls, with a few simple rules for when there's
>> more than one visible declaration?
>
> In order to prevent
>
> #include <string.h>
>
> // someone adds this somewhere, and arguments get flipped
> // downscope of it.
> char *strcpy(char *src, const char *dest);

So don't do that.

And don't this either:

#define strcpy(s1, s2) ((strcpy)((s2), (s1)))

> If we are going to have argument names that have a semantic
> purpose, I'd like those to be part of the declaration.
>
> If the standard declaration has been included via the proper header, the
> program should be defended against an incorrect declaration coming from
> somewhere else.

Adding named arguments should be fairly simple (though library functions
additionally defined as macros present some complications). Parameter
names can already be given in a function declaration. I just want to be
able to use them.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: C vs Haskell for XML parsing

<20230827194919.67@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28284&group=comp.lang.c#28284

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 03:00:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <20230827194919.67@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <87edjocbqj.fsf@nosuchdomain.example.com>
<20230827165554.489@kylheku.com> <87a5ubdhb2.fsf@nosuchdomain.example.com>
Injection-Date: Mon, 28 Aug 2023 03:00:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="10c6d898fd3a93281822b96d674293f3";
logging-data="1628565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/KJQfOdor5aZpZDJUlNo8smGAuxdObmn4="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:PdHfoXe0xqzBy/rH4PK8dqEHiv0=
 by: Kaz Kylheku - Mon, 28 Aug 2023 03:00 UTC

On 2023-08-28, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>> On 2023-08-27, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>> Why not just declare
>>> char *strcpy(const char *dest, char *src);
>>> and use those names in calls, with a few simple rules for when there's
>>> more than one visible declaration?
>>
>> In order to prevent
>>
>> #include <string.h>
>>
>> // someone adds this somewhere, and arguments get flipped
>> // downscope of it.
>> char *strcpy(char *src, const char *dest);
>
> So don't do that.

We could dispense with all sorts of static checking if we "don't do that".

If you don't pass incorrect types to strcpy, you can just declare it as:

char *strcpy();

The named arguments idea is purely a static gadget in which it's
possible to do sanity checks for consistency, which is a good argument
that it should be done.

There are many situations we can't easily check for at translation time.

> Adding named arguments should be fairly simple (though library functions
> additionally defined as macros present some complications). Parameter
> names can already be given in a function declaration. I just want to be
> able to use them.

You have to think of the C implementations that won't fix their
library declarations to the specified names where you'd like your
code to be able to run (if you have the compiler for it).

If this were rolled out, you would face situations where the names
coming from the header are not the right ones, or are completely
absent.

Programs would have to supply their own redeclarations of library
functions to make up for this.

In such a program, it would be a good idea to have those declarations
active even in an implementation that provides the standard-defined
names, so that those redeclarations get checked.

For that reason, it would be useful for a declaration to be able to
somehow assert "I provide argument names for use in calls (check
me against other such declarations)", versus "I'm a regular old
declaration that doesn't assert argument names (I don't speak to the
validity of declarations which do that).".

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

Re: C vs Haskell for XML parsing

<uche7g$1j3q5$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28291&group=comp.lang.c#28291

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 02:18:24 -0400
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <uche7g$1j3q5$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
<ipdGM.457101$xMqa.238959@fx12.iad> <uccitk$hhuj$1@dont-email.me>
<H2oGM.827787$TPw2.680260@fx17.iad> <ucd5kt$kl1p$1@dont-email.me>
<20230826123929.770@kylheku.com> <ucdp4i$ot46$1@dont-email.me>
<20230826210521.20@kylheku.com> <ucf86t$14b70$1@dont-email.me>
<20230827151627.814@kylheku.com> <kGQGM.834420$TPw2.617635@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Aug 2023 06:18:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="23b8818969a844dd39a0582a78445999";
logging-data="1675077"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2xgofWXVcFGoZMJYbriJRg524GIORGug="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:ke/tFGy0RjFiokyToOeNYgbCxy0=
Content-Language: en-US
In-Reply-To: <kGQGM.834420$TPw2.617635@fx17.iad>
 by: James Kuyper - Mon, 28 Aug 2023 06:18 UTC

On 8/27/23 19:06, Richard Damon wrote:
> On 8/27/23 6:45 PM, Kaz Kylheku wrote:
>> On 2023-08-27, Bart <bc@freeuk.com> wrote:
>>> On 27/08/2023 05:24, Kaz Kylheku wrote:
>>>> On 2023-08-26, Bart <bc@freeuk.com> wrote:
....
>> In the case of C structures, names count for compatibility.
>>
>> Two structure types that are structurally identical, occurring in
>> different translation units must have the same member names, in the
>> same order, in order to be considered compatible.
>
> Why? what difference can that make to the actual code generted?

Unfortunately, the C99 Rationale doesn't go into any detail about the
reasons for that requirement. I think that requirement is motivated by
the belief that such code is inherently confusing, and should therefore
not be required to work as you might expect it to.

> In C, the structures don't even need the same type name to be compatible.

That was changed in C99. If either structure type is given a tag, the
other one must be given the same tag.

> Again, that becomes a breaking change, and one that actually takes a lot
> of work to actually detect the error to give a diagnostic.

He's not describing a proposed change - that's what the current
requirements are:

"Two types have compatible type if their types are the same. ...
Moreover, two structure, union, or enumerated types declared in separate
translation units are compatible if their tags and members satisfy the
following requirements: If one is declared with a tag, the other shall
be declared with the same tag."

Note the same tag requirement.

"If both are completed anywhere within their respective translation
units, then the following additional requirements apply: there shall be
a one-to-one correspondence between their members such that each pair of
corresponding members are declared with compatible types; if one member
of the pair is declared with an alignment specifier, the other is
declared with an equivalent alignment specifier; and if one member of
the pair is declared with a name, the other is declared with the same name."

Note the same name requirement.

"For two structures, corresponding members shall be declared in the same
order. For two structures or unions, corresponding bit-fields shall have
the same widths. ..." (6.2.7p1)

Note also that this applies only for struct declarations in separate
translation units. Otherwise, struct types are covered only by the "same
type" part of the rule. Struct types declared with member lists are
considered to be new types in that translation unit. (6.7.2.1p10). Doing
so twice with the same tag in the same scope is a constraint violation
(6.7.2.3p1,5). Struct types declared in different scopes or with
different tags or no tag are considered distinct types (6.7.2.3p6). As a
result, two struct types defined in the same translation unit are never
compatible, regardless of how they are defined.

Re: C vs Haskell for XML parsing

<uchejm$1j7v3$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28292&group=comp.lang.c#28292

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 08:24:53 +0200
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <uchejm$1j7v3$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me>
<efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com>
<873505pdw0.fsf@bsb.me.uk> <ucg0lf$18cb9$6@dont-email.me>
<ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Aug 2023 06:24:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5b74ece49dc88b59e186868c281fd7d0";
logging-data="1679331"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PBJmQV5l4emFCRjROsGWbHBFNoCiF28A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:vlGF1jup26hM+K0rEs1GgztsJJA=
Content-Language: en-GB
In-Reply-To: <ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>
 by: David Brown - Mon, 28 Aug 2023 06:24 UTC

On 27/08/2023 20:18, Malcolm McLean wrote:
> On Sunday, 27 August 2023 at 18:21:00 UTC+1, David Brown wrote:
>> On 27/08/2023 01:44, Ben Bacarisse wrote:
>>>
>>> As it happens, I am not with David on this. There are many matters on
>>> which I think an appeal to authority carries significant weight. I
>>> don't know DMR's opinion of underscores (the code in K&R is indicative
>>> but not exactly conclusive), but I would take more time considering it
>>> than I would Kevin's or Barbara's. It's just one way to simplify life.
>> Ah, now it is /your/ turn to misunderstand the "appeal to authority"
>> fallacy - or at least, to Malcolm's use of it or my objection to his use.
>>
>> It's fine to "appeal to authority" as supporting evidence for a claim,
>> and it is absolutely appropriate to view DMR's opinion on C style in
>> higher standing than Kevin's or Barbara's.
>>
>> But it is fallacious to think of DMR's opinion as being proof that
>> Malcolm's theories are correct - at best, they could be supporting
>> evidence. (Even experts are wrong sometimes.) It is fallacious to
>> appeal to DMR's authority when his coding and writing don't actually
>> support Malcolm's ideas at all. It is fallacious to cherry-pick bits of
>> code that appear to support it, rather than looking at a wider selection
>> of his code. It is fallacious to consider his code written in different
>> circumstances than code written now (his tools had very limited lengths
>> of significant characters in identifiers).
>>
>> There's nothing wrong with using expert or authority opinion to bolster
>> an argument, when it is not fallacious.
>>
> No. Denis Ritchie didn't like const.

That may or may not be true - early C did not have const, but that is no
evidence for saying he didn't like it.

> But to say "const is a bad idea because
> Denis Ritchie didn't support it" is fallacious,

Correct.

> though obvioulsy Denis Ritchie
> almost certainly knows what he is talking about,

That's an assumption, not an "obvious" fact.

> and obvioulsy the committee
> has shown their inferiority inm many other ways.

That's an opinion (and a very unusual one at that), not an "obvious" fact.

> But you have to look at the
> arguments Ritchie used, not just say "Ritchie says so, so it is".

Yes, looking at his reasoning would be helpful, if he explained his
reasoning. I haven't personally read such reasoning, or even heard that
he had written it down. (I read The C Programming Language, many years
ago, but it does not mention "const", as far as I remember.)

But no, you don't have to look at the reasoning behind an expert opinion
to be able to use it appropriately in an argument. Equally, you can use
the reasoning fallaciously. The reason behind an expert's opinions or
comments is just another thing they said.

Since none of your three heroes have made any comments that are relevant
to your argument (and only two of them actually wrote anything at all),
all your use of "appeal to authority" is fallacious. None of them were
programming in modern languages with modern tools, and all had good
reason to write in a compact way. And there are literally billions of
other people who use word separators to make their writing clearer.
(Most of them have not or do not write modern programming code either.)

Can we please stop this now? You are looking more and more absurd with
every word you post. It's embarrassing.

Re: C vs Haskell for XML parsing

<dee77a79-b9c6-4528-b563-91e7491505cbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28293&group=comp.lang.c#28293

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:985:b0:76e:fdb4:c138 with SMTP id x5-20020a05620a098500b0076efdb4c138mr431646qkx.13.1693207956987;
Mon, 28 Aug 2023 00:32:36 -0700 (PDT)
X-Received: by 2002:a63:3ec6:0:b0:565:f8bd:cbc8 with SMTP id
l189-20020a633ec6000000b00565f8bdcbc8mr3146026pga.6.1693207956388; Mon, 28
Aug 2023 00:32:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 28 Aug 2023 00:32:35 -0700 (PDT)
In-Reply-To: <ucg4uo$19fkm$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:49ab:6c76:d8de:136a;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:49ab:6c76:d8de:136a
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <uca3sh$p9c$1@dont-email.me>
<efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com> <873505pdw0.fsf@bsb.me.uk>
<ucg0lf$18cb9$6@dont-email.me> <ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>
<ucg4uo$19fkm$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dee77a79-b9c6-4528-b563-91e7491505cbn@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 28 Aug 2023 07:32:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 9100
 by: Malcolm McLean - Mon, 28 Aug 2023 07:32 UTC

On Sunday, 27 August 2023 at 19:34:14 UTC+1, Kalevi Kolttonen wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
> > No. Denis Ritchie didn't like const. But to say "const is a bad idea because
> > Denis Ritchie didn't support it" is fallacious, though obvioulsy Denis Ritchie
> > almost certainly knows what he is talking about, and obvioulsy the committee
> > has shown their inferiority inm many other ways. But you have to look at the
> > arguments Ritchie used, not just say "Ritchie says so, so it is".
> I am sorry, I am a bit lazy today and cannot be bothered to do web
> searches. What exactly are Ritchie's arguments against "const"?
>
> I cannot think of any, but I have heard some that lend support
> to having, and properly using, "const".
>
He write them in a leter tot he committee many years ago.
I believe there was also apost to this newsgroup.

His main focus of ire was "no alias", but he also criticised const.

[Ritchie]

Let me begin by saying that I’m not convinced that even the pre-December qualifiers
(`const’ and `volatile’) carry their weight; I suspect that what they add to the cost of learning
and using the language is not repaid in greater expressiveness.

`Const’ is simultaneously more useful and more obtrusive; you can’t avoid learning about it,
because of its presence in the library interface. Nevertheless, I don’t argue for the extirpation
of qualifiers, if only because it is too late.
....

1. The qualifiers create an inconsistent language

A substantial fraction of the library cannot be expressed in the proposed language.

One of the simplest routines,

char *strchr(const noalias char *s, int c);

can return its first parameter. This first parameter must be declared with `const noalias;’
otherwise, it would be illegal (by the constraints on assignment, 3.3.16.1) to pass the address
of a const or noalias object. That is, the type qualifiers in the prototype are not merely an
optional pleasantry of the interface; they are required, if one is to pass some kinds of data to
this or most other library routines.

Unfortunately, there is no way in X3J11’s language for strchr to return the value it promises to,
because of the semantics of return (3.6.6.4) and casts (3.3.4). Whether the stripping of the const
and noalias qualifiers is done by cast inside strchr, or implicitly by its return statement, strchr
returns a pointer that (because of `const’) cannot be stored through, and (because of `noalias’)
cannot even be dereferenced; by the rules, it is useless. (Incidentally, I think this observation
was made by Tom Plum several years ago; it’s disconcerting that the inconsistency remains.)

Although the plain words of the Standard deny it, plastering the appropriate `non-const’ cast on
an expression to silence a compiler is sometimes safe, because the most probable implementation
of `const’ objects will allow them to be read through any access path, and will diagnose attempts to
change them by generating an access violation fault at run time. That is, in common implementations,
adding or taking away the `const’ qualifier of a pointer can never create any bugs not implicit in the
rule `do not modify a genuine const object through any access path.’

Nevertheless, I must emphasize that this is NOT the rule that X3J11 has written, and that its
library is inconsistent with its language. Someone writing an interpreter
using X3J11/88-001 is perfectly at liberty to (indeed, is advised to) carry with each pointer a
`modifiable’ bit, that (following 3.3.4) remains off when a pointer to a const-
qualified object is cast into a plain pointer. This implementation will prevent many of the real uses
of strchr, for example. I’m thinking of things like

if (p = strchr(q, ‘/’))
*p = ‘ ‘;

which are common and innocuous in C, but undefined by X3J11’s language.

A related observation is that string literals are not of type `array of const char.’ Indeed, the
Rationale (88-004 version) says, `However, string literals do not have [this type], in order to avoid
the problems of pointer type checking, particularly with library functions….’ Should this bald statement
be considered anything other than an admission that X3J11’s rules are screwy? It is ludicrous that
the committee introduces the `const’ qualifier, and also makes strings unwritable, yet is unable to
connect the two conceptions.
.....
compilers will ignore, or
only warn about, casts and assignments that X3J11 says are undefined, people will somehow survive

4. What to do?

Noalias must go. This is non-negotiable.

It must not be reworded, reformulated or reinvented. The draft’s description is badly flawed, but
that is not the problem. The concept is wrong from start to finish. It negates every brave promise
X3J11 ever made about codifying existing practices, preserving the existing body of code, and
keeping (dare I say it?) `the spirit of C.’

Const has two virtues: putting things in read-only memory, and expressing interface restrictions.
For example, saying

char *strchr(const char *s, int c);

is a reasonable way of expressing that the routine cannot change the object referred to by its first argument.
I think that minor changes in wording preserve the virtues, yet eliminate the contradictions in the current scheme.

1) Reword page 47, lines 3-5 of 3.3.4 (Cast operators), to remove the undefinedness of modifying pointed-to
objects, or remove these lines altogether (since casting non-qualified to qualified isn’t discussed explicitly either.)

2) Rewrite the constraint on page 54, lines 14-15, to say that pointers may be assigned without taking
qualifiers into account.

3) Preserve all current constraints against modifying non-modifiable lvalues, that is things of
manifestlyconst-qualified type.

4) String literals have type `const char []’.

5) Add a constraint (or discussion or example) to assignment that makes clear the
illegality of assigning to an object whose actual type is const-qualified, no matter what
access path is used. There is a manifest constraint that is easy to check (left side is not const-
qualified), but also a non-checkable constraint (left side is not secretly const-qualified). The
effect should be that converting between pointers to const- qualified and plain objects is legal
and well-defined; avoiding assignment through pointers that derive ultimately from `const’ objects
is the programmer’s responsibility.

These rules give up a certain amount of checking, but they save the consistency of the language.

[Malcolm]
I think there's an element of politicing in agreeing to const in the last section. His real
object is to get rid of noalias.So he throws the committe a sop. They can have const,
with a few provisos.

Re: C vs Haskell for XML parsing

<24081c60-e8eb-467d-a5e2-3ac05104b03en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28294&group=comp.lang.c#28294

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:818c:b0:76f:8b7:1fa8 with SMTP id ot12-20020a05620a818c00b0076f08b71fa8mr186069qkn.6.1693208571140;
Mon, 28 Aug 2023 00:42:51 -0700 (PDT)
X-Received: by 2002:a05:622a:1a19:b0:403:996b:1390 with SMTP id
f25-20020a05622a1a1900b00403996b1390mr706932qtb.11.1693208570936; Mon, 28 Aug
2023 00:42:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 28 Aug 2023 00:42:50 -0700 (PDT)
In-Reply-To: <ucg9ou$1a678$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:49ab:6c76:d8de:136a;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:49ab:6c76:d8de:136a
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com> <uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <87h6onfje9.fsf@nosuchdomain.example.com>
<66653005-66fa-4a89-8b1f-0b415fb7e8ean@googlegroups.com> <yJnGM.142651$ftCb.40495@fx34.iad>
<03a4b2f0-92a7-4652-86f6-66f7d5cf8853n@googlegroups.com> <ucg9ou$1a678$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <24081c60-e8eb-467d-a5e2-3ac05104b03en@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 28 Aug 2023 07:42:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3717
 by: Malcolm McLean - Mon, 28 Aug 2023 07:42 UTC

On Sunday, 27 August 2023 at 20:56:28 UTC+1, James Kuyper wrote:
> On 27/08/2023 07:54, Malcolm McLean wrote:
> > On Saturday, 26 August 2023 at 15:10:54 UTC+1, Scott Lurndal wrote:
> ...
> >> The sources I found indicate that it wasn't intended to be read by anyone
> >> other than the person who wrote it.
> >>
> > Just goes to show that you can believe everything you read.
> > Do you think that is remotely plausible?
> The Wikipedia article on Scriptio Continua gives precisely that
> explanation. That explanation is bracketed by two citations - it's not
> clear which of the two is most relevant:
>
>
> Moore, F. C. T. (2001). "Scribes and Texts: A Test Case for Models of
> Cultural Transmission". The Monist. 84 (3): 421.
> doi:10.5840/monist200184325. JSTOR 27903738. Retrieved March 24, 2023.
>
> Parkes, M. B. "Antiquity: Aids for Inexperienced Readers and the
> Prehistory of Punctuation". Pause and Effect: An Introduction to the
> History of Punctuation in the West. Berkeley: U of California, 1993. 10–11.
>
> I would not recommend dismissing that thesis out of hand without first
> following up on those citations and learning what reasons they give for
> believing it to be true.
>
Scriptio Continua was used for about 2,000 years. So it's not difficult to read.
This is a knock-down, simple, almost irrefutable point.

However it was eventually abandoned, and text with spaces is easier to read..
That doesn't make text without spaces difficult to read. People work out complex
and rather tendentious theories about why the ancients used Scriptio Continua
and moderns use text separated by spaces.

You need to understand the strength of the simple, obvious argument, before you
try to snipe at it with sophisticated objections.

M.B. Parkes was my teacher at Oxford by the way. He taught me this stuff.

Re: C vs Haskell for XML parsing

<uchmgi$1kdo7$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28297&group=comp.lang.c#28297

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 10:39:45 +0200
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <uchmgi$1kdo7$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<87h6onfje9.fsf@nosuchdomain.example.com>
<66653005-66fa-4a89-8b1f-0b415fb7e8ean@googlegroups.com>
<yJnGM.142651$ftCb.40495@fx34.iad>
<03a4b2f0-92a7-4652-86f6-66f7d5cf8853n@googlegroups.com>
<ucg9ou$1a678$1@dont-email.me>
<24081c60-e8eb-467d-a5e2-3ac05104b03en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 28 Aug 2023 08:39:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e81667950acd893cb93e6800794cb322";
logging-data="1718023"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+44EHsSvt/8McNFenZ1ti9ZmXDApFSkY0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:zAVUsLhBn0SLpDDEXEJrgCupg6w=
In-Reply-To: <24081c60-e8eb-467d-a5e2-3ac05104b03en@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Mon, 28 Aug 2023 08:39 UTC

On 28/08/2023 09:42, Malcolm McLean wrote:
> On Sunday, 27 August 2023 at 20:56:28 UTC+1, James Kuyper wrote:
>> On 27/08/2023 07:54, Malcolm McLean wrote:
>>> On Saturday, 26 August 2023 at 15:10:54 UTC+1, Scott Lurndal wrote:
>> ...
>>>> The sources I found indicate that it wasn't intended to be read by anyone
>>>> other than the person who wrote it.
>>>>
>>> Just goes to show that you can believe everything you read.
>>> Do you think that is remotely plausible?
>> The Wikipedia article on Scriptio Continua gives precisely that
>> explanation. That explanation is bracketed by two citations - it's not
>> clear which of the two is most relevant:
>>
>>
>> Moore, F. C. T. (2001). "Scribes and Texts: A Test Case for Models of
>> Cultural Transmission". The Monist. 84 (3): 421.
>> doi:10.5840/monist200184325. JSTOR 27903738. Retrieved March 24, 2023.
>>
>> Parkes, M. B. "Antiquity: Aids for Inexperienced Readers and the
>> Prehistory of Punctuation". Pause and Effect: An Introduction to the
>> History of Punctuation in the West. Berkeley: U of California, 1993. 10–11.
>>
>> I would not recommend dismissing that thesis out of hand without first
>> following up on those citations and learning what reasons they give for
>> believing it to be true.
>>
> Scriptio Continua was used for about 2,000 years.

It was closer to 1000 years. There have been plenty of totally absurd
ideas that have lasted far longer, and had far more consequence - the
"four humors" theory of medicine being a prime example. Age is no
indication of quality.

And Scriptio Continua was by no means universal. The old Latin and
Greek writings we have include some with spaces, and some with
inter-word dots, as well as some without spacing of any kind.

> So it's not difficult to read.

Non-sequitor, and total nonsense. Text (in alphabetic script) without
some kind of word spacing /is/ difficult to read. Once it became more
important for many people to read each written text, legibility became
more important compared to other factors (such as the cost of writing
material), and word spacing very quickly overtook. It did so because it
was easier to read - after all, there are no other benefits to word spacing.

> This is a knock-down, simple, almost irrefutable point.

No. It is bollocks.

>
> However it was eventually abandoned,

"Eventually" ? Seriously? Do you have any concept about how rare it
was to write anything at all (in Western Europe) before word spacing
became ubiquitous?

> and text with spaces is easier to read.

Oh, so you /do/ understand a little!

> That doesn't make text without spaces difficult to read.

Yes, it is /very/ hard to read. Try it.

> People work out complex
> and rather tendentious theories about why the ancients used Scriptio Continua
> and moderns use text separated by spaces.
>

Yes - people that are a lot smarter and more knowledgable than you, and
that don't have some bizarre agenda to try to "prove" that their unique
and illegible naming style is somehow better than what everyone else uses.

> You need to understand the strength of the simple, obvious argument, before you
> try to snipe at it with sophisticated objections.
>
> M.B. Parkes was my teacher at Oxford by the way. He taught me this stuff.

Appeal to authority again? Except this time you have picked an
"authority" that is meaningless to your audience, and who would probably
be horrified to hear what a jumbled mess you have made of his teachings,
and how you misuse your misunderstandings to justify bad coding (based
on the Wikipedia article and references).

Re: C vs Haskell for XML parsing

<uchno8$1kjtk$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28298&group=comp.lang.c#28298

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 11:00:55 +0200
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <uchno8$1kjtk$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<ucfusp$18cb9$3@dont-email.me> <87pm38cihm.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Aug 2023 09:00:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e81667950acd893cb93e6800794cb322";
logging-data="1724340"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TnKW1ZMCrDwGbIWuH4gXz4pV7vCkFdjY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:vEBM6Wn3fl7qXo5J95tuxMT7LwE=
Content-Language: en-GB
In-Reply-To: <87pm38cihm.fsf@nosuchdomain.example.com>
 by: David Brown - Mon, 28 Aug 2023 09:00 UTC

On 27/08/2023 22:56, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
>> On 25/08/2023 20:59, Keith Thompson wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
> [...]
>>>> Any resolution here would place restrictions on which functions could
>>>> support named parameters - such as consistent declarations and
>>>> definitions, but it would be impossible (in general) to check them.
>>>
>>> Any parameter names in a call would just have to be consistent with
>>> the names in the visible prototype. I don't see a problem.
>>
>> You can have both "void foo(int a, int b);" and "void foo(int b, int
>> a);" declarations visible at the same time.
>
> So have a rule that the most recent declaration applies. If you write
> two declarations with deliberately misleading parameter names, you get
> what you deserve.
>
>> And if one translation unit defined "void foo(int a, int b);", while
>> another declared "void foo(int b, int a);" and used that with named
>> parameters, you would not get the correct call.
>
> True. So don't do that.

That would boil down to undiagnosable undefined behaviour - and I'd
rather avoid that. If there was a way to enforce checking here, it
would be significantly better (IMHO). To me, avoiding mistakes is the
most important justification for named parameters.

Since we can't do anything about currently legal declarations and
definitions with different (or missing) parameter names, I think we want
a new or modified syntax for the declaration and definition of functions
that can use named parameters. I think that with this new type of
declaration, the rules should be that a function should either be
"static" and have at most one forward declaration, or non-static and
have exactly one "extern" declaration in scope before it, and that the
parameter names and styles (such as pointers or array parameter) match
exactly. This would not force programmers to have declarations in a
single header that is included by both the defining TU and TU's that use
the function, but it would strongly encourage it. And it would make it
a lot harder to get wrong.

Since this would conflict with existing styles used in some code, I
think we'd need a new syntax (or a new function attribute or qualifier).
It's possible that compilers could have a flag to apply such checks by
default (gcc has "-Wmissing-declarations -Wredundant-declarations", but
no check on parameter names AFAIK), but that would be an implementation
option, useful to some people and not others.

>
>> If you required the compiler to enforce that all declarations and
>> definitions of a function used the same parameter names, then you'd do
>> much better. (There is still scope for errors, but would be basically
>> the same as we have today for calling functions with incorrect numbers
>> or types of arguments.) But that would conflict with existing code
>> that was valid before.
>
> I might have advocated requiring parameter names to be consistent
> (basically making parameter names as well as their types, part of the
> function signature), but it's too late for that.
>
>> So you'd need a new syntax to say that a function must have all its
>> declarations having consistent parameter names. You'd have to write
>> "void foo(int a static, int b static);" !
>
> No, I don't think you do.
>
> [...]
>

Re: C vs Haskell for XML parsing

<ac994d20-9887-4f93-a9e2-ed78224a91can@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28299&group=comp.lang.c#28299

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:18e6:b0:63d:38f1:fc82 with SMTP id ep6-20020a05621418e600b0063d38f1fc82mr703779qvb.8.1693213393312;
Mon, 28 Aug 2023 02:03:13 -0700 (PDT)
X-Received: by 2002:a05:6a00:2d07:b0:68a:2c24:57d7 with SMTP id
fa7-20020a056a002d0700b0068a2c2457d7mr10581772pfb.0.1693213392819; Mon, 28
Aug 2023 02:03:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Mon, 28 Aug 2023 02:03:12 -0700 (PDT)
In-Reply-To: <uchmgi$1kdo7$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:49ab:6c76:d8de:136a;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:49ab:6c76:d8de:136a
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com> <uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com> <uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <87h6onfje9.fsf@nosuchdomain.example.com>
<66653005-66fa-4a89-8b1f-0b415fb7e8ean@googlegroups.com> <yJnGM.142651$ftCb.40495@fx34.iad>
<03a4b2f0-92a7-4652-86f6-66f7d5cf8853n@googlegroups.com> <ucg9ou$1a678$1@dont-email.me>
<24081c60-e8eb-467d-a5e2-3ac05104b03en@googlegroups.com> <uchmgi$1kdo7$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ac994d20-9887-4f93-a9e2-ed78224a91can@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 28 Aug 2023 09:03:13 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3677
 by: Malcolm McLean - Mon, 28 Aug 2023 09:03 UTC

On Monday, 28 August 2023 at 09:40:00 UTC+1, David Brown wrote:
> On 28/08/2023 09:42, Malcolm McLean wrote:
>
> > People work out complex
> > and rather tendentious theories about why the ancients used Scriptio Continua
> > and moderns use text separated by spaces.
> >
> Yes - people that are a lot smarter and more knowledgable than you, and
> that don't have some bizarre agenda to try to "prove" that their unique
> and illegible naming style is somehow better than what everyone else uses.
>
> > You need to understand the strength of the simple, obvious argument, before you
> > try to snipe at it with sophisticated objections.
> >
>
A simple, straightforwards, obvious and natural point takes priority. Scriptio Continua
was used for 2000 years (first texts about 700 BC or so, the last texts 13th century
- I make that about 2000 years). So if it was difficut to read, would it have been
used for so long? Obviously not. People would have used dots or vertical lines,
both of which were used in very early Latin and Greek texts, and occasionally appear
in later manuscripts, but weren't very popular.

You have to learn how to draw conclusions from the information, not to trawl through
material looking for reasons to object to the obvious, because you are naturally
contentious in character.
>
> > M.B. Parkes was my teacher at Oxford by the way. He taught me this stuff.
>
> Appeal to authority again? Except this time you have picked an
> "authority" that is meaningless to your audience, and who would probably
> be horrified to hear what a jumbled mess you have made of his teachings,
> and how you misuse your misunderstandings to justify bad coding (based
> on the Wikipedia article and references).
>
Not really. When your old tutor's works come up, it's natural to mention that
he was your tutor.

Re: C vs Haskell for XML parsing

<uchoii$1kl9e$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28300&group=comp.lang.c#28300

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 11:14:58 +0200
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <uchoii$1kl9e$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me>
<efcf98fa-f078-490c-99fa-5c281cadcebbn@googlegroups.com>
<873505pdw0.fsf@bsb.me.uk> <ucg0lf$18cb9$6@dont-email.me>
<ed2e87a5-7930-41c4-b29c-2d91227ea50cn@googlegroups.com>
<ucg4uo$19fkm$1@dont-email.me>
<dee77a79-b9c6-4528-b563-91e7491505cbn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 28 Aug 2023 09:14:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e81667950acd893cb93e6800794cb322";
logging-data="1725742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/avUKD4leIDX6fJ851Pw1ak4WD6EEt/S8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:EgRB8VTcWgOXBmf4SftIkjHnoH8=
In-Reply-To: <dee77a79-b9c6-4528-b563-91e7491505cbn@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Mon, 28 Aug 2023 09:14 UTC

On 28/08/2023 09:32, Malcolm McLean wrote:
> On Sunday, 27 August 2023 at 19:34:14 UTC+1, Kalevi Kolttonen wrote:
>> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
>>> No. Denis Ritchie didn't like const. But to say "const is a bad idea because
>>> Denis Ritchie didn't support it" is fallacious, though obvioulsy Denis Ritchie
>>> almost certainly knows what he is talking about, and obvioulsy the committee
>>> has shown their inferiority inm many other ways. But you have to look at the
>>> arguments Ritchie used, not just say "Ritchie says so, so it is".
>> I am sorry, I am a bit lazy today and cannot be bothered to do web
>> searches. What exactly are Ritchie's arguments against "const"?
>>
>> I cannot think of any, but I have heard some that lend support
>> to having, and properly using, "const".
>>
> He write them in a leter tot he committee many years ago.
> I believe there was also apost to this newsgroup.
>
> His main focus of ire was "no alias", but he also criticised const.
>
> [Ritchie]
>
> Const has two virtues: putting things in read-only memory, and expressing interface restrictions.
> For example, saying
>
> char *strchr(const char *s, int c);
>
> is a reasonable way of expressing that the routine cannot change the
> object referred to by its first argument.
> I think that minor changes in wording preserve the virtues, yet
> eliminate the contradictions in the current scheme.
>
> [Malcolm]
> I think there's an element of politicing in agreeing to const in the last section. His real
> object is to get rid of noalias.So he throws the committe a sop. They can have const,
> with a few provisos.

It seems very clear to me from that letter that he found the concept of
"const" to be good and useful - but it needed some changes to the
wording in the standard and details of conversions involving "const".
He pointed out the well-known issues with "const" in functions like
"strchr" - but that "const" is useful despite being imperfect.

I see no indication that he is "throwing the committee a sop" - his
dislike of "noalias" is explicitly "non-negotiable", and entirely
independent of his other points.

Your interpretation of this letter is very strongly coloured by what you
wish it said, rather than what he actually wrote.


devel / comp.lang.c / Re: C vs Haskell for XML parsing

Pages:123456789101112
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor