Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

We don't really understand it, so we'll give it to the programmers.


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

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

  copy mid

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

  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 22:17:44 +0100
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <87sf82n9xj.fsf@bsb.me.uk>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<uchejm$1j7v3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1c35b718727ecba87d6437feb1cbcad9";
logging-data="1973308"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/r+w5RzEgmjO1L3ktbPL2rpRx0JqNRecY="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:Iy1S5fKh83jOKM2wTCc0kfPJHCo=
sha1:BhIJIOgH00HNgcn8/2+UzBfQzeY=
X-BSB-Auth: 1.0269485d5b9a01f85606.20230828221744BST.87sf82n9xj.fsf@bsb.me.uk
 by: Ben Bacarisse - Mon, 28 Aug 2023 21:17 UTC

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

> On 27/08/2023 20:18, Malcolm McLean wrote:

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

Malcolm may have better sources (he does not cite them) but I suspect
the view that DMR did not like const comes from am essay he wrote to the
committee about type attributes in January of 1988[1].

A now defunct attribute (noalias -- an early attempt at restrict) was
his main target, but the draft definition of const was also unworkable.
Since the draft is not preserved (as far as I know) you have to work
backwards from the problems he describes and the changes he proposed to
see what's wrong, but it does sound broken.

However, he was prepared to say of const that is has

"two virtues: putting things in read-only memory, and expressing
interface restrictions"

which is, essentially, what const is now. The wording he objected to
was changed. Did DMR end up liking const? I don't think there is much
evidence either way, but the sematics, as it was eventually defined, had
what he considered to be some virtues.

He /really/ objected to the proposed noalias attribute. In the same
document he concludes "Noalias must go. This is non-negotiable." In
fact, let me quote more from the conclusion:

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

There follow 5 detailed changes that pretty much align const with what
it is today. So DMR's position on the final form of const would seem
to be that typical uses are reasonable and that its virtues have been
preserved.

And, in a salute to better days, I note that DMR posted the whole thing
on comp.lang.c (nntp:7753@alice.UUCP).

[1] https://www.lysator.liu.se/c/dmr-on-noalias.html

--
Ben.

Re: C vs Haskell for XML parsing

<e88888de-b29d-4361-8cc4-35c1e54950c5n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:3c88:b0:76e:fffd:4732 with SMTP id tp8-20020a05620a3c8800b0076efffd4732mr383044qkn.1.1693257755714;
Mon, 28 Aug 2023 14:22:35 -0700 (PDT)
X-Received: by 2002:a05:622a:244:b0:3fd:df16:18f4 with SMTP id
c4-20020a05622a024400b003fddf1618f4mr833391qtx.8.1693257755297; Mon, 28 Aug
2023 14:22:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!nntp.club.cc.cmu.edu!45.76.7.193.MISMATCH!3.us.feeder.erje.net!feeder.erje.net!border-1.nntp.ord.giganews.com!nntp.giganews.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 14:22:35 -0700 (PDT)
In-Reply-To: <ucj0m0$1rpih$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>
<ac994d20-9887-4f93-a9e2-ed78224a91can@googlegroups.com> <uci0fa$1m3b3$1@dont-email.me>
<20230828092201.893@kylheku.com> <ucim5r$1pvn0$1@dont-email.me>
<bac17518-cf9a-4f43-b86d-c5e468f437d5n@googlegroups.com> <ucj0m0$1rpih$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e88888de-b29d-4361-8cc4-35c1e54950c5n@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 28 Aug 2023 21:22:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 63
 by: Malcolm McLean - Mon, 28 Aug 2023 21:22 UTC

On Monday, 28 August 2023 at 21:39:42 UTC+1, David Brown wrote:
> On 28/08/2023 21:31, Malcolm McLean wrote:
> > On Monday, 28 August 2023 at 18:40:26 UTC+1, David Brown wrote:
> >> On 28/08/2023 18:35, Kaz Kylheku wrote:
> >>> On 2023-08-28, David Brown <david...@hesbynett.no> wrote:
> >>
> >>>> This means that in at least some cases, the use of continuous text was
> >>>> motivated by factors that outweighed legibility - perhaps costs, perhaps
> >>>> intentionally making the text harder to read.
> >>>
> >>> Like, maybe, keeping the illiterate rabble illiterate, maintaining the
> >>> status quo that only a tiny elite can read and write?
> >>>
> >> Yes. Writing without spaces isn't much harder than writing with spaces,
> >> but reading it is a lot harder. As a member of the elite, you don't
> >> want reading to be easier for others.
> >>
> >> Even within the elite classes, your ability to read unspaced texts
> >> quickly (or, more often, your ability to afford a scribe who could read
> >> it) was a status symbol. It was like serving larks' tongues at dinner -
> >> you don't do it because they are tasty or nutritious, you do it because
> >> they are expensive.
> >>
> >> I don't think anyone can say how much of an influence such reasons were,
> >> but it is certainly one of several reasons given by historians.
> >>
> > And then in the next paragraph, the same people claim that spaces were
> > omitted to save expensive parchment.
> Yes. Does it surprise you that there could be several reasons for
> something? Or that different people might have different reasons? Or
> that historians might have different theories?
>
To simultaneously argue that it was luxury consumption - deliberately making
text hard to read to force one to employ a more expensive scribe and therefore
flaunt one's wealth, and it was designed to save parchment is obviously self-
contradictory.
Since we know that parchment was expensive, and omiiting spaces obviously
saved parchment, it is entirely reasonable to suggest that this was a factor.
However most people who were interested in books in the ancient world were
not short of money.
>
> > You don't deliberately make things difficult for yourself. These suggestions
> > are all most implausible.
> They are all far more plausible than thinking it was easy to read.
>
No, not at all. People read it for two thousand years. It's entirely plausible
that it wasn't difficult, just not as easy as text with spaces.
>
> > We don't really know why the Greeks used scriptio continua whilst the Jews
> > did not. We do know that they did.
> Agreed. But we know some things that were not the reason for it. They
> did not omit spaces to make the writing more legible. That's a starting
> point at least.
>
The spaces weren't invented. The Jews had them. But the Greeks were reluctant
to take ideas from the Jews. The codex wasn't invented either until the first
century, but it's a lot easier to use than a scroll. However scrolls are not
extraordinarily difficult to use.
As I said, very early Greek texts and Latin texts before about 100 BC used dots
to separate words. These were later omitted. The motive for that may well have
been to improve legibility. Because spaces between words do make text easier
to read, it doesn't follow that symbols between words do the same.

Re: C vs Haskell for XML parsing

<4474df0c-b2ea-41d5-94d2-faa6b239a5c1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:198a:b0:76c:deff:8c42 with SMTP id bm10-20020a05620a198a00b0076cdeff8c42mr1016245qkb.14.1693258518140;
Mon, 28 Aug 2023 14:35:18 -0700 (PDT)
X-Received: by 2002:a17:902:eccc:b0:1b8:a555:385d with SMTP id
a12-20020a170902eccc00b001b8a555385dmr9906146plh.9.1693258517803; Mon, 28 Aug
2023 14:35:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!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 14:35:17 -0700 (PDT)
In-Reply-To: <87sf82n9xj.fsf@bsb.me.uk>
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>
<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>
<uchejm$1j7v3$1@dont-email.me> <87sf82n9xj.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4474df0c-b2ea-41d5-94d2-faa6b239a5c1n@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Mon, 28 Aug 2023 21:35:18 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4414
 by: Malcolm McLean - Mon, 28 Aug 2023 21:35 UTC

On Monday, 28 August 2023 at 22:17:59 UTC+1, Ben Bacarisse wrote:
> David Brown <david...@hesbynett.no> writes:
> > On 27/08/2023 20:18, Malcolm McLean wrote:
>
> >> 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.
>
> Malcolm may have better sources (he does not cite them) but I suspect
> the view that DMR did not like const comes from am essay he wrote to the
> committee about type attributes in January of 1988[1].
>
> There follow 5 detailed changes that pretty much align const with what
> it is today. So DMR's position on the final form of const would seem
> to be that typical uses are reasonable and that its virtues have been
> preserved.
>
> And, in a salute to better days, I note that DMR posted the whole thing
> on comp.lang.c (nntp:77...@alice.UUCP).
>
In the introduction, Ritchie says
"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."

and then

"Volatile', in particular, is a frill for esoteric applications, and much better expressed
by other means. Its chief virtue is that nearly everyone can forget about it. `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."

So this doesn't sound like a man greatly enamoured of const. There's an element of
politiking - const is a fait accompli, and since his primary target is noalias, he can
throw a sop to the committee, which is that he will accept const, with modifications.

But essentially he shares my view that, yes, a rational argument can be made for
const and there are some situations where it is helpful. But these reasons are not
very strong, and it has disadvantages which haven't been acknowledged.

However the main problem with const as it was proposed was that casting a const
pointer to a non-const pointer was undefined, even if the const pointer was ultimately
derived from a pointer to mutable data.

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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: Mon, 28 Aug 2023 14:38:27 -0700
Organization: None to speak of
Lines: 23
Message-ID: <87zg2ac0fg.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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
Injection-Info: dont-email.me; posting-host="bc514d5855dc6fc2634690c4c79f2ba3";
logging-data="1971422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190Tjx68lavu8vbS/6eDhZ9"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:8Sz3Eb/PszZKHD9g/k3WU8Y9YWg=
sha1:HeaQCFXEcbDlSctLT7lvaqv5jjg=
 by: Keith Thompson - Mon, 28 Aug 2023 21:38 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
> No. Denis Ritchie didn't like const.

Perhaps there's some confusion about an article Dennis Ritchie (note
spelling) made to this newsgroup in 1988, reproducing an essay he had
sent to X3J11.

He acknowledges that his discussion about const and volatile was based
on wording that was later changed. (He even advocated giving string
literals type `const char[]`.)

https://www.lysator.liu.se/c/dmr-on-noalias.html

(This is the article where he wrote "Noalias must go. This is
non-negotiable.".)

Malcolm, consider not speaking for Dennis Ritchie.

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

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

  copy mid

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

  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: Mon, 28 Aug 2023 14:50:58 -0700
Organization: None to speak of
Lines: 14
Message-ID: <87ttsibzul.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>
<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
Injection-Info: dont-email.me; posting-host="bc514d5855dc6fc2634690c4c79f2ba3";
logging-data="1983459"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189gbZOFc9h2b826LEej/80"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:a5oIlA8hTKrX8a8J20OMi7kDuPw=
sha1:JD7rC+Zs5OVYg5SNAN3r3RGyBwM=
 by: Keith Thompson - Mon, 28 Aug 2023 21:50 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
> 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.

Since this point is "almost irrefutable", I suggest we all stop
wasting our time trying to refute it. Nobody other than Malcolm
takes it seriously, and Malcolm will not change his mind.

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

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

  copy mid

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

  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: Mon, 28 Aug 2023 14:50:06 -0700
Organization: None to speak of
Lines: 14
Message-ID: <87v8cybzw1.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>
<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
Injection-Info: dont-email.me; posting-host="bc514d5855dc6fc2634690c4c79f2ba3";
logging-data="1971422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n1iBhM73IQ1IVOb1JNid1"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:cpbP1ktmZGzdoqe2ZVu/n03OjIo=
sha1:Vjo0KiRc4BLnkUkHigfNNrTRIkU=
 by: Keith Thompson - Mon, 28 Aug 2023 21:50 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
[...]
> 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.

Since this point is "almost irrefutable", I suggest we all stop
wasting our time trying to refute it. Nobody other than Malcolm
takes it seriously, and Malcolm will not change his mind.

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

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

  copy mid

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

  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: Mon, 28 Aug 2023 15:12:57 -0700
Organization: None to speak of
Lines: 72
Message-ID: <87pm36byty.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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>
<uchno8$1kjtk$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ed26b27079df73f30517d092e55bb48b";
logging-data="1990691"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TlbsAhdObWqkRMsXt2W4q"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:lThV+LvX5M4oIMu+lRawi+yNPXU=
sha1:pTTEozVgPmsm3cT6GgIsAkE2WNs=
 by: Keith Thompson - Mon, 28 Aug 2023 22:12 UTC

David Brown <david.brown@hesbynett.no> writes:
> On 27/08/2023 22:56, Keith Thompson wrote:
>> David Brown <david.brown@hesbynett.no> writes:
[...]
>>> 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.

An implementation could warn about it, assuming it keep information
about parameter names in separately compiled translation units.

But we're talking about defining a function in one file, and then
writing an inconsistent declaration for that function in another file.
It's already easy to get undefined behavior that way -- and easy to
avoid it, by putting function declarations in headers that are included
by all source files that define or call the function.

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

We can do something about current declarations and definitions. We can
define the behavior, and specify the few cases where the behavior is
undefined. If there are no parameter names in the visible declaration,
you can't use named arguments. If there are multiple compatible
declarations with differing parameter names (which is confusing and
easily avoidable), use the last one.

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

How much harder does it have to be? A declaration that swaps the
parameter names would almost have to be deliberate, perhaps something
for the IOCCC.

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

I don't think any of that is necessary, and I think it would make the
new feature more complicated, likely to the point that it would be
rejected.

Keep it simple. Parameters have names. For historical reasons, you can
redeclare a function with different parameter names, but it's a bad idea
unless you're doing it very carefully for the purpose of improving code
clarity.

[...]

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

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

  copy mid

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

  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: Mon, 28 Aug 2023 15:22:14 -0700
Organization: None to speak of
Lines: 53
Message-ID: <87ledubyeh.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> <86edjnxo81.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ed26b27079df73f30517d092e55bb48b";
logging-data="1990691"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/am/lVyIb+j0BUdzIl4IRM"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:4dlhW7UC925FtNvSsIa14fp+l+g=
sha1:vmWyolVwhyIIw6933A0InPhAOPI=
 by: Keith Thompson - Mon, 28 Aug 2023 22:22 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
> [named function arguments]
>
>>> 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?
>
> Amusing that both of thesse declarations get the qualifiers
> wrong.

I am suitably amused.

char *strcpy(char *restrict dst, const char *restrict src);

(And we could discuss about how far "destination" and "source" should be
abbreviated.)

> I favor a different approach to this problem:
>
> static inline char *
> copy_to_from( char *to, const char *from ){
> return strcpy( to, from );
> }
>
> with no language changes needed. And people are still free to
> use the more concise form if they so desire.

But if we change the names used in the standard for strcpy's parameters,
there's no need for a wrapper function (with, in your approach, a name
that doesn't suggest that it operates on strings).

Your wrapper would be useful only if the language added named arguments,
yes? I'd expect that an edition of the standard that added named
arguments would also rework the argument names in the standard library.

Even without named arguments, I don't think "s1" and "s2" the best
choices for parameters of strcpy(). They're consistent with strcmp(),
but they don't need to be. It makes no semantic difference, but IMHO
the description would be a little clearer with more meaningful names.

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

<ucj7n7$1svn8$1@dont-email.me>

  copy mid

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

  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 23:39:35 +0100
Organization: A noiseless patient Spider
Lines: 213
Message-ID: <ucj7n7$1svn8$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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> <q_1HM.144952$ftCb.122801@fx34.iad>
<uciccb$1o58a$1@dont-email.me> <uciinp$1p8qk$1@dont-email.me>
<uciju2$1pkgn$1@dont-email.me> <ucine0$1q9jg$1@dont-email.me>
<ucirmk$1r066$1@dont-email.me> <20230828125920.929@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 28 Aug 2023 22:39:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70e739b11476752941fe44fcd807cd05";
logging-data="1998568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JRW9526LIQN8OJfAnJDoIJY2VdlYYzIc="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:HLk1sTAaZfAWjgGEk1546uBQAzM=
In-Reply-To: <20230828125920.929@kylheku.com>
 by: Bart - Mon, 28 Aug 2023 22:39 UTC

On 28/08/2023 21:37, Kaz Kylheku wrote:
> On 2023-08-28, Bart <bc@freeuk.com> wrote:
>> On 28/08/2023 19:01, David Brown wrote:
>>> On 28/08/2023 19:01, Bart wrote:
>>
>>>> Why is the standard moving backwards?
>>>
>>> What do you mean?
>>>
>>> C2x allows you to omit names for parameters you don't use in a function
>>> definition.  How is that "moving backwards" ?
>>
>> We want a stricter language moving forward and less of the crazy
>> flexibility of older versions.
>
> What?
>
>> What other missing bits of syntax can we assign some arbitrary meaning
>> to rather than being called out as obvious errors?
>>
>> How about, leaving out a function name in a definition, when that
>> function is not called?
>
> Yes, that is possible with this same feature:
>
>
> void foo_api_bar_impl(int arg, void (*)(char *))
> {
> // ...
> }
>
> This bar implementation of the foo API found that it didn't need to
> store or call the function pointer parameter, so it didn't name it.

My remark was about leaving out the main name of the function, like:

void (int arg, void (*)(char *)){}

If this function is never called, then it might stop some compilers
reporting that fact.

Although you will quickly find this is not practical: if you have a lot
of such anonymous functions, that you later need to call, you will no
longer know which is which.

Which helps to highlight another thing with missing parameter names; say
you end up with a function like this:

void F(int a, int, char* c, char*, int, int, int) {}

Later you decide that you do need to use one of those parameters, but
which one was it? That useful information imparted by the name doesn't
exist.

> In C++ implementations, this feature suppresses warnings about unused
> parameters. If it's not used, but not named, then there is nothing to
> complain about.
>
> C++ based this on *existing* syntax in ANSI C: namely that in an ANSI C
> prototype declaration, parameter names can be omitted.

That's not really surprising, since probably the same bit of grammar
covers both declaration and definition parameter lists.

And in the former, names can be added or omitted on a per-parameter basis.

So, an untidy bit of syntax, all-told.

(In the syntaxes I use, it is stricter:

* Parameters all have types only, no names (only in FFIs)
* Parameters all have types and names
* Parameters have names only (only in dynamic code)

You can't mix and match. And of course, a function definition must be
one of the last two. As is also necessary to make use of keyword
parameters and/or default values.

Detecting unused variables of any sort I consider the job of a tool
other than the compiler, although the compiler can make use of such info
internally to improve the code.)

> C++ just allowed that syntax in definitions, which looks like a
> miniscule extension that has as a palpable impact on usability.
>
> C programmers have wasted lines of code on things like
>
> void foo_api_bar_impl(int arg, void (*fn)(char *))
> {
> UNUSED(fn); // this project's own unused macro
> }

Excuse me, but that is just a problem with the compiler. You shouldn't
need to modify or annotation your code, or removed potentially useful
information, just to silence a warning.

I think if I had to do something on those lines, I would use parameter
names starting with '$'. Then no warnings are given; I don't need to
annotate; I can use a more consistent grammar rule; and I retain a
reminder of what the names for those parameters not currently refered to;

I could even use that parameter name later, with the '$', but it might
be simpler to delete that one character.

>>>> But this one is unusual: normally newer gcc tries to continue passing
>>>> legacy code that older versions passed. Now, it can be passing code
>>>> that older versions *failed*.
>>>
>>> And the problem with that is... what?  Nothing, as far as I can see.
>>
>> It was an error before for a good reason. Now somebody decided you need
>> to take away some redundancy so that they can declare unused parameters
>> without the compiler moaning about it.
>
> C++ has had this feature for decades. Adopting it into C improves the
> range of compatibility between the languages.

What was it used for in C++?

> Accidentally missing a name makes itself loudly heard when you use
> the name and it's not defined.
>
> You could have a bug whereby it is defined, but in an outer scope;
> that's too bad for you.

That's not a bug. It's called shadowing, a useful feature meaning you
can reuse identifiers in their own private scope, without needing to
have unique identifiers throughout a translation unit. This is not assembly!

> Since standard C doesn't have nested functions, that would have to be a
> clash between a intended/forgotten local and global, which indicates
> that you're using a local-like naming scheme for globals.

But gnu C has. Which itself leads to slightly inexplicable errors when
you forget the } at the end of a function, and the following 400
functions are assumed to be nested.

> If you think you will use the parameters, you will likely put in
> their names and live with the unused diagnostics which remind you
> to complete the work.

Sometimes I have a suite of functions which must all share the same
signature, as they accessed from a table of function pointers.

But the functions do different somewhat different tasks and may not use
all the parameters. I wouldn't be happy about those 200 or whatever
functions ending up with parameter lists looking like this:

(int a, int b, int c)
(int a, int, int)
(int a, int b, int)
(int, int, int c)

>> Yet an overzealous compiler might warn about an unused parameter name.
>
> This is not overzealous. Diagnosis of unused lexical variables uncovers
> bugs. You want this in any language with lexical scopes, and to be on by
> default.

So you run a tool to check that every so often, or use that compiler option.

> Code bombs when run:
>
> 4> [*3]
> ** expr-2:1: variable y is not defined
>
> Unused variables are code smell which can indicate an actual
> bug like: (defun add (x y) (+ x x)).

OK, so that's good. But here you want to use that parameter.

What happens what you really want to use only x, but it is necessary to
pass two (maybe it has to be a certain pattern); how do you indicate
that here?

Leave out y turns in into a one-parameter function; it needs to be two!

So it's trickier in a language without type annotations as place-holders.

>
> Sometimes unused variables are just crumbs left after refactoring;
> it's good to clean them out.
>
>> There must be better ways of shutting it up than deleting the name
>> completely. So, what was it again, when you decide to use it?
>
> If the option is available in the syntax, there is nothing better.

I mentioned a possibility above.

> All else being equal, subtracting a token to achieve a goal is
> better than adding more tokens.

You're also taking away what could be vital information needed to
restore the name, or deciding which parameter you restoring it to.

>> GCC Fail Pass
>> Clang Fail Warning
>> MSVC Fail Fail

> They are a newer dialect of C. Obviously, you can't use the feature
> if your code has to work with older compilers (that are not C++).

And yet, using the most recent versions of 3 major compilers at the time
of writing, one passes, one warns, one fails!

Talk about being equivocal. You'd think a C compiler would know whether
an input is valid C or not.

Re: C vs Haskell for XML parsing

<86msyawz1t.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 16:02:38 -0700
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <86msyawz1t.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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> <ac994d20-9887-4f93-a9e2-ed78224a91can@googlegroups.com> <uci0fa$1m3b3$1@dont-email.me> <20230828092201.893@kylheku.com> <ucim5r$1pvn0$1@dont-email.me> <bac17518-cf9a-4f43-b86d-c5e468f437d5n@googlegroups.com> <ucj0m0$1rpih$1@dont-email.me> <e88888de-b29d-4361-8cc4-35c1e54950c5n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2001730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0GA6eBLm90dBtJ51eBS/tjGK2cGkUjZQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:XElpysOVcD7//bSk2jJjiXneIDA=
sha1:fHnE7sHhzJEr7vpBu236XrEcQ3g=
 by: Tim Rentsch - Mon, 28 Aug 2023 23:02 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:

[..ancient writing systems..]

Malcolm, will you please stop going on about this crap?
It has long since stopped being topical in this newsgroup.

Re: C vs Haskell for XML parsing

<86il8ywyu5.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 16:07:14 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <86il8ywyu5.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com> <uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com> <j=2ifExxFfXU05g0F@bongo-ra.co> <ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com> <87pm3bot1n.fsf@bsb.me.uk> <7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com> <ucdcaf$mj8h$1@dont-email.me> <627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com> <ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2001730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192GRGTcC0odBz33XAkGIjxKDNOeQ6WC4Y="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:1G/vcAwcUXJj7fOuv5DgyQqy7qw=
sha1:RbudvblGJCgcs2A0wgYNXmeuBGs=
 by: Tim Rentsch - Mon, 28 Aug 2023 23:07 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> I will use [underscore] in preference to CamelCase, which I dislike
> primarily because of the impact on my typing speed.

In most cases I find CamelCase harder to read than using
underscores, especially when using mono-spaced fonts.

Re: C vs Haskell for XML parsing

<86edjmwyr4.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 16:09:03 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <86edjmwyr4.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <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> <q_1HM.144952$ftCb.122801@fx34.iad> <uciccb$1o58a$1@dont-email.me> <uciinp$1p8qk$1@dont-email.me> <uciju2$1pkgn$1@dont-email.me> <ucine0$1q9jg$1@dont-email.me> <ucirmk$1r066$1@dont-email.me> <zy6HM.837180$TPw2.12699@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2001730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tVXQRy07pwTBm0k1n6u0I2AXKRK4bOAM="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:epd7HDZfWO+yjJMGZcVPxPkjIjI=
sha1:UTLhq9QRCjegbFRs72cCi5JO7cc=
 by: Tim Rentsch - Mon, 28 Aug 2023 23:09 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

[...]

> Are you using the royal "we" here?

I think the narcissistic "we" is more likely.

Re: C vs Haskell for XML parsing

<86a5uawykr.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 16:12:52 -0700
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <86a5uawykr.fsf@linuxsc.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> <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>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2001730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18879kRerkZsTarXxZ1wASj+MtZOLPZOXw="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:YSmQm3ctGKEm/b5NafVBxaEk/UI=
sha1:1rsGTrUZx6oyImplqAkTfXn9eck=
 by: Tim Rentsch - Mon, 28 Aug 2023 23:12 UTC

kalevi@kolttonen.fi (Kalevi Kolttonen) writes:

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

Current thinking in programming language design tends to favor
read-only being the default, with assignable variables needing
an explicit indicator.

I modestly suggest the keyword "prost" as a type qualifier to
mean modifiable.

Re: C vs Haskell for XML parsing

<865y4ywycj.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 16:17:48 -0700
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <865y4ywycj.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com> <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> <j=2ifExxFfXU05g0F@bongo-ra.co> <ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com> <87pm3bot1n.fsf@bsb.me.uk> <7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com> <87wmxhnyub.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2001730"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19aKiHLs/kXqRWZEjeMquPL03VVMAKYcTQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:e55vOJgsjSNV1lnXhaIXYbm/uRg=
sha1:aalo5Ljl9OYpuXD5EJ68lmokGWw=
 by: Tim Rentsch - Mon, 28 Aug 2023 23:17 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

[..regarding the naming of size_t..]

> And, in fact, I was actually thinking rhetorically -- how would
> I word it to tip the result? I was considering: "is size_t a
> sound engineering compromise or a dog's breakfast?".

STOP!

You're /both/ right!!!

The name size_t is a sound engineering compromise AND a dog's
breakfast.

Re: C vs Haskell for XML parsing

<861qfmwwvy.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Mon, 28 Aug 2023 16:49:21 -0700
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <861qfmwwvy.fsf@linuxsc.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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> <86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2018636"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lz3fPuE2LrIe+gN/6i42rOe8XP4f7yvs="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:WiUeEBuL2qUFtLVMFOtDlYmWGYA=
sha1:IKQOI7t2pyp7RMrc43aTM0OVlmc=
 by: Tim Rentsch - Mon, 28 Aug 2023 23:49 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>
>> [named function arguments]
>>
>>>> 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?
>>
>> I favor a different approach to this problem:
>>
>> static inline char *
>> copy_to_from( char *to, const char *from ){
>> return strcpy( to, from );
>> }
>>
>> with no language changes needed. And people are still free to
>> use the more concise form if they so desire.
>
> But if we change the names used in the standard for strcpy's parameters,

Part of the point of my approach is that it doesn't need any
changes to the C standard.

> there's no need for a wrapper function (with, in your approach, a name
> that doesn't suggest that it operates on strings).

That's incidental. It could be copy_string_to_from();

> Your wrapper would be useful only if the language added named arguments,
> yes?

Not at all, that's the point. The function name indicates where
the destination (to) and source (from) arguments go. There is
no reason a declaration has to use those names, or any names at
all, for the function parameters. All the information needed
is present in the name of the function.

> I'd expect that an edition of the standard that added named
> arguments would also rework the argument names in the standard library.

Part of the advantage of the approach I favor is it doesn't
need to wait for a new edition of the C standard. I think
there are lots of cases where simply adopting a coding style
obviates any need for new language features.

> Even without named arguments, I don't think "s1" and "s2" the best
> choices for parameters of strcpy(). They're consistent with strcmp(),
> but they don't need to be. It makes no semantic difference, but IMHO
> the description would be a little clearer with more meaningful names.

In the context of the C standard, and especially for strcpy(), I
don't see anything wrong with s1 and s2. Moreover using s1 and s2
means there won't be any bike-shedding arguments about what the
names should be.

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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: Mon, 28 Aug 2023 17:11:42 -0700
Organization: None to speak of
Lines: 59
Message-ID: <87h6oibtc1.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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> <86edjnxo81.fsf@linuxsc.com>
<87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ed26b27079df73f30517d092e55bb48b";
logging-data="2010029"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196lPLcVSMRaZ+R8vBiLSiQ"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:I8WWrklOXwjHliSdUrLTmHxv6qw=
sha1:/ZbGT0zYtqiaALCKKHSH2JT9Hqw=
 by: Keith Thompson - Tue, 29 Aug 2023 00:11 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>> [named function arguments]
>>>
>>>>> 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?
>>>
>>> I favor a different approach to this problem:
>>>
>>> static inline char *
>>> copy_to_from( char *to, const char *from ){
>>> return strcpy( to, from );
>>> }
>>>
>>> with no language changes needed. And people are still free to
>>> use the more concise form if they so desire.
>>
>> But if we change the names used in the standard for strcpy's parameters,
>
> Part of the point of my approach is that it doesn't need any
> changes to the C standard.

Ah, I misunderstood your point.

This subthread has been about how named arguments should be implemented.
You're saying that if named arguments *aren't* added as a new feature,
providing a wrapper function whose name indicates meanings of the
parameters

I would never bother to write or use the wrapper function you suggest.
I deal with the potential ambiguity in the parameters of strcpy() by
remembering that the destination is first, analagous to an assignment.
I speculate that you do the same.

I'm sympathetic to arguments that named arguments shouldn't be added to
C because it would be too complex. I personally think it would be a
worthwhile change, but I can certainly live without it. But if it were
added, it could be very useful in writing more legible code. strcpy()
is just one example. More compelling examples are functions that take
one or more bool arguments. I've used languages (Ada, Python) with
named arguments, and found the feature very useful.

[...]

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

<20230828160956.758@kylheku.com>

  copy mid

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

  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: Tue, 29 Aug 2023 00:23:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 152
Message-ID: <20230828160956.758@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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>
<q_1HM.144952$ftCb.122801@fx34.iad> <uciccb$1o58a$1@dont-email.me>
<uciinp$1p8qk$1@dont-email.me> <uciju2$1pkgn$1@dont-email.me>
<ucine0$1q9jg$1@dont-email.me> <ucirmk$1r066$1@dont-email.me>
<20230828125920.929@kylheku.com> <ucj7n7$1svn8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 29 Aug 2023 00:23:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3c0f43010e46fd6ed1f1ed87a863f28a";
logging-data="2027822"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8tqcK2cdPjR8t2krx89hz1yFyD2MkBjI="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:oa447EySaz3JBLemm5EDVRV2Wbc=
 by: Kaz Kylheku - Tue, 29 Aug 2023 00:23 UTC

On 2023-08-28, Bart <bc@freeuk.com> wrote:
> On 28/08/2023 21:37, Kaz Kylheku wrote:
>> On 2023-08-28, Bart <bc@freeuk.com> wrote:
>>> On 28/08/2023 19:01, David Brown wrote:
>>>> On 28/08/2023 19:01, Bart wrote:
>>>
>>>>> Why is the standard moving backwards?
>>>>
>>>> What do you mean?
>>>>
>>>> C2x allows you to omit names for parameters you don't use in a function
>>>> definition.  How is that "moving backwards" ?
>>>
>>> We want a stricter language moving forward and less of the crazy
>>> flexibility of older versions.
>>
>> What?
>>
>>> What other missing bits of syntax can we assign some arbitrary meaning
>>> to rather than being called out as obvious errors?
>>>
>>> How about, leaving out a function name in a definition, when that
>>> function is not called?
>>
>> Yes, that is possible with this same feature:
>>
>>
>> void foo_api_bar_impl(int arg, void (*)(char *))
>> {
>> // ...
>> }
>>
>> This bar implementation of the foo API found that it didn't need to
>> store or call the function pointer parameter, so it didn't name it.
>
> My remark was about leaving out the main name of the function, like:
>
> void (int arg, void (*)(char *)){}
>
> If this function is never called, then it might stop some compilers
> reporting that fact.

In fact we can write, equivalently:

void foo_api_bar_impl(int arg, void (char *))
// ^ no name

Leaving out the top-level name of a function is interesting, but
I don't see how it makes sense.

The reason we would likee to remove the parameter name is that
the parameter must continue to exist; it itself cannot be removed, since
the calls to the functions are passing it an argument.

If a function is not called from anywhere, we just remove it.

We can't always edit calls to a function to remove an argument.
Sometimes in code we don't control, and possibly in callback interfaces
with multiple implementations, where you can't/don't want to remove a
parameter even if you do control everything.

> Although you will quickly find this is not practical: if you have a lot
> of such anonymous functions, that you later need to call, you will no
> longer know which is which.
>
> Which helps to highlight another thing with missing parameter names; say
> you end up with a function like this:
>
> void F(int a, int, char* c, char*, int, int, int) {}

If this is registered as a callback somewhere, we find that line:

register_foo_callback(F, whatever);

Then we look at the definitition of that to understand what the
arguments mean.

F could also have a declaration where the parameters are named,
and the could be documented in a block comment there.
>
>> In C++ implementations, this feature suppresses warnings about unused
>> parameters. If it's not used, but not named, then there is nothing to
>> complain about.
>>
>> C++ based this on *existing* syntax in ANSI C: namely that in an ANSI C
>> prototype declaration, parameter names can be omitted.
>
> That's not really surprising, since probably the same bit of grammar
> covers both declaration and definition parameter lists.
>
> And in the former, names can be added or omitted on a per-parameter basis.
>
> So, an untidy bit of syntax, all-told.

It's untidy; only, the viable alternatives are worse.

> (In the syntaxes I use, it is stricter:
> * Parameters all have types only, no names (only in FFIs)
> * Parameters all have types and names
> * Parameters have names only (only in dynamic code)

That's very nice, but you've not convinced the world to standardize
on those syntaxes, and develop an entire free operating system,
and multitude of tools and applications, and so on.

For now we are stuck with what we have.

People working on replacements are by and large making the programming
experience worse. More complicated, more convoluted, more siloed into
their little necks of the woods.

Make me a concrete recommendation on how to code, and what with.

In my work and side projects, I target 32 and 64 bit ARM boards,
desktop GNU/Linuxes (Ubuntu, Debian, Nix, Guix, ...), MacOS, Solaris,
Android.

> Detecting unused variables of any sort I consider the job of a tool
> other than the compiler, although the compiler can make use of such info
> internally to improve the code.)

So you like tools other than the compiler eh? Oh, except when they
are called "make" for building stuff, and whatnot; then tools not
in the compiler are bad.

If a compiler just improves the code (e.g. eliminatees dead code)
but doesn't remark on unusd variables, it's being only halfway helfpul.

This is really a "low hanging fruit" diagnosis; it has a decent payoff
relative to implementation cost and difficulty.

>> C++ just allowed that syntax in definitions, which looks like a
>> miniscule extension that has as a palpable impact on usability.
>>
>> C programmers have wasted lines of code on things like
>>
>> void foo_api_bar_impl(int arg, void (*fn)(char *))
>> {
>> UNUSED(fn); // this project's own unused macro
>> }
>
> Excuse me, but that is just a problem with the compiler. You shouldn't
> need to modify or annotation your code, or removed potentially useful
> information, just to silence a warning.

Yet, someone hit upon that idea, and people liked it.

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

<ucjei2$1tv7s$1@dont-email.me>

  copy mid

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

  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: Tue, 29 Aug 2023 01:36:18 +0100
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <ucjei2$1tv7s$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Aug 2023 00:36:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70e739b11476752941fe44fcd807cd05";
logging-data="2030844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HKCy6CeqmS6KHWxUYqcxKGKxpA1EmuHc="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:t0CSh6XLomJ8fQh7Xte1o667aGU=
In-Reply-To: <861qfmwwvy.fsf@linuxsc.com>
 by: Bart - Tue, 29 Aug 2023 00:36 UTC

On 29/08/2023 00:49, Tim Rentsch wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>
>>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>>
>>> [named function arguments]
>>>
>>>>> 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?
>>>
>>> I favor a different approach to this problem:
>>>
>>> static inline char *
>>> copy_to_from( char *to, const char *from ){
>>> return strcpy( to, from );
>>> }
>>>
>>> with no language changes needed. And people are still free to
>>> use the more concise form if they so desire.
>>
>> But if we change the names used in the standard for strcpy's parameters,
>
> Part of the point of my approach is that it doesn't need any
> changes to the C standard.
>
>> there's no need for a wrapper function (with, in your approach, a name
>> that doesn't suggest that it operates on strings).
>
> That's incidental. It could be copy_string_to_from();
>
>> Your wrapper would be useful only if the language added named arguments,
>> yes?
>
> Not at all, that's the point. The function name indicates where
> the destination (to) and source (from) arguments go. There is
> no reason a declaration has to use those names, or any names at
> all, for the function parameters. All the information needed
> is present in the name of the function.

So you've just moving the parameter names to the name of the function.

You're now back to remembering the order, by having to remember the name
of the function.

The parts of the name for the N arguments, and the N arguments
themselves are now disjoint.

You don't have the choice of using a short function name and using
non-keyword parameters. You might want to do that if you can remember
which way around the strcpy arguments go.

You can't apply the scheme to existing functions that are exported using
a certain name from their libraries; you'd have to write wrapper functions.

And it's not really scalable to many arguments. It also would not allow
for optional arguments, or allowing for your own choice of argument order.

>> I'd expect that an edition of the standard that added named
>> arguments would also rework the argument names in the standard library.
>
> Part of the advantage of the approach I favor is it doesn't
> need to wait for a new edition of the C standard.

But then things will never change.

Re: C vs Haskell for XML parsing

<20230828182115.305@kylheku.com>

  copy mid

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

  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: Tue, 29 Aug 2023 01:22:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <20230828182115.305@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me>
Injection-Date: Tue, 29 Aug 2023 01:22:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3c0f43010e46fd6ed1f1ed87a863f28a";
logging-data="2041699"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CadUlu5XEwwGV3yqQx/vAopNPpp/d1MQ="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:KxeMlPCH91Pokt0sZU3yk35rRxg=
 by: Kaz Kylheku - Tue, 29 Aug 2023 01:22 UTC

On 2023-08-29, Bart <bc@freeuk.com> wrote:
> On 29/08/2023 00:49, Tim Rentsch wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Part of the advantage of the approach I favor is it doesn't
>> need to wait for a new edition of the C standard.
>
> But then things will never change.

But when they do change, you will try things on three random compilers,
one of which speaks its own native dialect by default, one which has
that new standard and a third which doesn't and then proclaim that the
language is in chaos; will the real C language stand up?

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

<uck607$2563l$1@dont-email.me>

  copy mid

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

  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: Tue, 29 Aug 2023 09:16:23 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uck607$2563l$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
<87pm3bot1n.fsf@bsb.me.uk>
<7a9b3883-ee9f-4d46-944c-c11d4f0354d5n@googlegroups.com>
<ucdcaf$mj8h$1@dont-email.me>
<627cbd87-75d6-49e9-b2e0-733ca17b7cean@googlegroups.com>
<ucftjs$186cs$1@dont-email.me> <gN1HM.144949$ftCb.130257@fx34.iad>
<86il8ywyu5.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Aug 2023 07:16:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="68c8913f885bb67e9411c9a871c3d10d";
logging-data="2267253"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LDyGxGLEWUuBI7EvmW0f467pZ2LY8mkU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:a8a+xZ6zP0kAx+5okvCfjHRSg/s=
Content-Language: en-GB
In-Reply-To: <86il8ywyu5.fsf@linuxsc.com>
 by: David Brown - Tue, 29 Aug 2023 07:16 UTC

On 29/08/2023 01:07, Tim Rentsch wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> I will use [underscore] in preference to CamelCase, which I dislike
>> primarily because of the impact on my typing speed.
>
> In most cases I find CamelCase harder to read than using
> underscores, especially when using mono-spaced fonts.

I used to use camelCase for most of my identifiers - now I find I am
using underscores much more, precisely because I find it easier to read.
I strongly suspect it is age-related - camelCase was more appealing
when my eyes were younger.

Re: C vs Haskell for XML parsing

<6dcdb286-1371-4b0b-935d-0c543782eb3cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ad4:4f4d:0:b0:649:e869:ec71 with SMTP id eu13-20020ad44f4d000000b00649e869ec71mr982779qvb.1.1693296089939;
Tue, 29 Aug 2023 01:01:29 -0700 (PDT)
X-Received: by 2002:a63:aa4e:0:b0:563:e937:5e87 with SMTP id
x14-20020a63aa4e000000b00563e9375e87mr5285295pgo.5.1693296088993; Tue, 29 Aug
2023 01:01:28 -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: Tue, 29 Aug 2023 01:01:28 -0700 (PDT)
In-Reply-To: <20230828160956.758@kylheku.com>
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>
<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> <q_1HM.144952$ftCb.122801@fx34.iad>
<uciccb$1o58a$1@dont-email.me> <uciinp$1p8qk$1@dont-email.me>
<uciju2$1pkgn$1@dont-email.me> <ucine0$1q9jg$1@dont-email.me>
<ucirmk$1r066$1@dont-email.me> <20230828125920.929@kylheku.com>
<ucj7n7$1svn8$1@dont-email.me> <20230828160956.758@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6dcdb286-1371-4b0b-935d-0c543782eb3cn@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 29 Aug 2023 08:01:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2630
 by: Malcolm McLean - Tue, 29 Aug 2023 08:01 UTC

On Tuesday, 29 August 2023 at 01:23:52 UTC+1, Kaz Kylheku wrote:
>
> If a compiler just improves the code (e.g. eliminatees dead code)
> but doesn't remark on unusd variables, it's being only halfway helfpul.
>
> This is really a "low hanging fruit" diagnosis; it has a decent payoff
> relative to implementation cost and difficulty.
>
The problem is that people have a hysterical attitude to warnings, and
that occasionally, not so often, but not so infrequently either, there is
a legitimate need for an unused variable.
The obvious case is an unused parameter which is necessary to pass
the function indirectly, because other functions called through the same
function pointer do use the parameter.

Re: C vs Haskell for XML parsing

<uckeel$26q6m$1@dont-email.me>

  copy mid

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

  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: Tue, 29 Aug 2023 10:40:38 +0100
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <uckeel$26q6m$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me>
<20230828182115.305@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 29 Aug 2023 09:40:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70e739b11476752941fe44fcd807cd05";
logging-data="2320598"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LHp5iJmjQgImiVdk7KwC3CohDe5Mmb0I="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:3F77yz7tbch1tV8aFFSL/5UqBGo=
In-Reply-To: <20230828182115.305@kylheku.com>
 by: Bart - Tue, 29 Aug 2023 09:40 UTC

On 29/08/2023 02:22, Kaz Kylheku wrote:
> On 2023-08-29, Bart <bc@freeuk.com> wrote:
>> On 29/08/2023 00:49, Tim Rentsch wrote:
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> Part of the advantage of the approach I favor is it doesn't
>>> need to wait for a new edition of the C standard.
>>
>> But then things will never change.
>
> But when they do change, you will try things on three random compilers,
> one of which speaks its own native dialect by default, one which has
> that new standard and a third which doesn't and then proclaim that the
> language is in chaos; will the real C language stand up?
>

Here's an example of people being afraid of change:

Most C compilers accept '$' within identifiers. I find that useful as a
more visually distinct 'special' character than '_' which already has
lots of official meanings.

The exceptions had been lcc-win32 (but years ago), where '$' could only
be used at certain places in a name.

And in Tiny C, until version 0.9.27, when it only worked if you gave
this ridiculous option:

-fdollars-in-identifiers

Tiny C isn't the most conforming compiler around; what are they actually
afraid of by just allowing it anyway?

There is always something. Wasn't that half the point of 'make' and
'configure'?

Now, maybe C doesn't officially sanction the use of '$', in which case
why do most compilers accept it?

gcc 13.2.0 will reject it using '-std=c89 -Wpedantic', and accept it if
anything else is used, but n1570.pdf (C11 draft) doesn't specifically
mention it.

So is '$' allowed or not? Can I safely use it with any compiler apart
from Tiny C? I don't know.

(I use '$' extensively in machine-generated code.)

Re: C vs Haskell for XML parsing

<uckefj$26moa$1@dont-email.me>

  copy mid

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

  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: Tue, 29 Aug 2023 11:41:07 +0200
Organization: A noiseless patient Spider
Lines: 89
Message-ID: <uckefj$26moa$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 29 Aug 2023 09:41:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="68c8913f885bb67e9411c9a871c3d10d";
logging-data="2317066"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qm905zqTzrqkSfLXib8HH/zh1VGWA+Y0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:0agPsoFKuntfcyOS1vOIMyNdc94=
Content-Language: en-GB
In-Reply-To: <ucjei2$1tv7s$1@dont-email.me>
 by: David Brown - Tue, 29 Aug 2023 09:41 UTC

On 29/08/2023 02:36, Bart wrote:
> On 29/08/2023 00:49, Tim Rentsch wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>
>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>>
>>>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>>>
>>>> [named function arguments]
>>>>
>>>>>> 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?
>>>>
>>>> I favor a different approach to this problem:
>>>>
>>>>      static inline char *
>>>>      copy_to_from( char *to, const char *from ){
>>>>          return  strcpy( to, from );
>>>>      }
>>>>
>>>> with no language changes needed.  And people are still free to
>>>> use the more concise form if they so desire.
>>>
>>> But if we change the names used in the standard for strcpy's parameters,
>>
>> Part of the point of my approach is that it doesn't need any
>> changes to the C standard.
>>
>>> there's no need for a wrapper function (with, in your approach, a name
>>> that doesn't suggest that it operates on strings).
>>
>> That's incidental.  It could be copy_string_to_from();
>>
>>> Your wrapper would be useful only if the language added named arguments,
>>> yes?
>>
>> Not at all, that's the point.  The function name indicates where
>> the destination (to) and source (from) arguments go.  There is
>> no reason a declaration has to use those names, or any names at
>> all, for the function parameters.  All the information needed
>> is present in the name of the function.
>
> So you've just moving the parameter names to the name of the function.
>
> You're now back to remembering the order, by having to remember the name
> of the function.
>

While you still need to remember things, it does make it harder to get
the order wrong when writing the code or for someone else reading the code.

> The parts of the name for the N arguments, and the N arguments
> themselves are now disjoint.
>
> You don't have the choice of using a short function name and using
> non-keyword parameters. You might want to do that if you can remember
> which way around the strcpy arguments go.
>
> You can't apply the scheme to existing functions that are exported using
> a certain name from their libraries; you'd have to write wrapper functions.
>
> And it's not really scalable to many arguments. It also would not allow
> for optional arguments, or allowing for your own choice of argument order.
>

I agree with all these points.

>
>>> I'd expect that an edition of the standard that added named
>>> arguments would also rework the argument names in the standard library.
>>
>> Part of the advantage of the approach I favor is it doesn't
>> need to wait for a new edition of the C standard.
>
> But then things will never change.
>
>

Re: C vs Haskell for XML parsing

<6618fc2b-2ff1-4f2f-897e-6ec48ecc2b16n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:1848:b0:64a:8826:d5f2 with SMTP id d8-20020a056214184800b0064a8826d5f2mr961583qvy.5.1693302800392;
Tue, 29 Aug 2023 02:53:20 -0700 (PDT)
X-Received: by 2002:a63:7944:0:b0:56a:36ac:3238 with SMTP id
u65-20020a637944000000b0056a36ac3238mr5132924pgc.5.1693302799724; Tue, 29 Aug
2023 02:53:19 -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: Tue, 29 Aug 2023 02:53:19 -0700 (PDT)
In-Reply-To: <uckeel$26q6m$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>
<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>
<86edjnxo81.fsf@linuxsc.com> <87ledubyeh.fsf@nosuchdomain.example.com>
<861qfmwwvy.fsf@linuxsc.com> <ucjei2$1tv7s$1@dont-email.me>
<20230828182115.305@kylheku.com> <uckeel$26q6m$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6618fc2b-2ff1-4f2f-897e-6ec48ecc2b16n@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 29 Aug 2023 09:53:20 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3741
 by: Malcolm McLean - Tue, 29 Aug 2023 09:53 UTC

On Tuesday, 29 August 2023 at 10:40:53 UTC+1, Bart wrote:
> On 29/08/2023 02:22, Kaz Kylheku wrote:
> > On 2023-08-29, Bart <b...@freeuk.com> wrote:
> >> On 29/08/2023 00:49, Tim Rentsch wrote:
> >>> Keith Thompson <Keith.S.T...@gmail.com> writes:
> >>> Part of the advantage of the approach I favor is it doesn't
> >>> need to wait for a new edition of the C standard.
> >>
> >> But then things will never change.
> >
> > But when they do change, you will try things on three random compilers,
> > one of which speaks its own native dialect by default, one which has
> > that new standard and a third which doesn't and then proclaim that the
> > language is in chaos; will the real C language stand up?
> >
> Here's an example of people being afraid of change:
>
> Most C compilers accept '$' within identifiers. I find that useful as a
> more visually distinct 'special' character than '_' which already has
> lots of official meanings.
>
> The exceptions had been lcc-win32 (but years ago), where '$' could only
> be used at certain places in a name.
>

> Now, maybe C doesn't officially sanction the use of '$', in which case
> why do most compilers accept it?
>
Off-label use. If dollar signs are not allowed in identifiers in valid C programs,
but still accepted by the compiler, then the dollar sign becomes a symbol
which can be used, but not in C programs which are passed to someone else.
>
> (I use '$' extensively in machine-generated code.)
>
Exactly. Prefixing everything with a dollar sign is a good way of making your
machine-generated identifier match an identifier entered by the user, whilst
avoiding any possibility of a name clash.

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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: Tue, 29 Aug 2023 03:00:49 -0700
Organization: None to speak of
Lines: 34
Message-ID: <87a5uab226.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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> <86edjnxo81.fsf@linuxsc.com>
<87ledubyeh.fsf@nosuchdomain.example.com> <861qfmwwvy.fsf@linuxsc.com>
<ucjei2$1tv7s$1@dont-email.me> <20230828182115.305@kylheku.com>
<uckeel$26q6m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ed26b27079df73f30517d092e55bb48b";
logging-data="2333105"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19scGEhGSwMHwKtzV+WgYCb"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:pT0ikJtbAf5Qg+rRpHKQQFRhIwI=
sha1:/EgVfzlBIjbK/UYiBrVaeB+XKno=
 by: Keith Thompson - Tue, 29 Aug 2023 10:00 UTC

Bart <bc@freeuk.com> writes:
[...]
> Now, maybe C doesn't officially sanction the use of '$', in which case
> why do most compilers accept it?
>
> gcc 13.2.0 will reject it using '-std=c89 -Wpedantic', and accept it
> if anything else is used, but n1570.pdf (C11 draft) doesn't
> specifically mention it.

In C89/C90, the syntax for an identifier allowed only the 52 uppercase
and lowercase Latin letters, underscores, and decimal digits.

C99 added universal-character-names and "other implementation-defined
characters".

So a conforming C99 or later compiler may or may not accept '$' in
identifiers. A conforming C90 compiler cannot.

(You saw that the gcc's behavior changed between "-std=c89 -Wpedantic"
and "-std=c99 -Wpedantic". It never occurred to you to check the C99
standard or the N1256 draft to see if the syntax of an identifier had
changed, did it?)

> So is '$' allowed or not? Can I safely use it with any compiler apart
> from Tiny C? I don't know.

See above.

> (I use '$' extensively in machine-generated code.)

--
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 */


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

Pages:123456789101112
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor