Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

19 May, 2024: Line wrapping has been changed to be more consistent with Usenet standards.
 If you find that it is broken please let me know here rocksolid.nodes.help


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

<ucabgk$2691$1@dont-email.me>

  copy mid

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

  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: Fri, 25 Aug 2023 14:49:08 +0100
Organization: A noiseless patient Spider
Lines: 72
Message-ID: <ucabgk$2691$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<610a41a0-a3a3-4e01-a9a7-8b5e1fe31ec0n@googlegroups.com>
<87350dtive.fsf@bsb.me.uk> <ubvan6$1rb3s$1@dont-email.me>
<3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Aug 2023 13:49:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b32b7e3c2c2dcce32b0082dd75f1882d";
logging-data="71969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mvbMahjhbIkzz5pcR0lPPbUFcfeT5Rx0="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:hRJ3SsgrhBv6t8mnkzXncfo2QIQ=
In-Reply-To: <uc9m7v$3u797$1@dont-email.me>
 by: Bart - Fri, 25 Aug 2023 13:49 UTC

On 25/08/2023 08:46, David Brown wrote:
> On 24/08/2023 16:50, Malcolm McLean wrote:

>> Languages that allow named parameters are nice, and if I was extending C
>> I would introduce that. The problem is that there are a few basic
>> mathematical
>> functions like tan() which are conventionally written tan(value), and
>> that was
>> then used a model for what other functions would be like. However only
>> a few
>> user-written functions calculate similar basic mathematical functions.
>> Generally it make sense to write payroll(employees=emp, Nemployees=N,
>> taxcode=1234), not payroll(emp, N, 1234);
>
> There are good historical reasons for why named parameters are not
> common in older languages, but are more common in newer ones.  And there
> are good technical reasons why they would be difficult to introduce to C
> as an afterthought.

Which are?

>  But I agree with you that they can be helpful and
> improve code readability, in languages that support them.

Actually, when I call functions defined via a C header via my FFI, I can
apply keyword parameters if I want, /and/ define default values for
missing arguments. They don't need to be written in one of those languages.

So whereas in C I have to write this:

MessageBox(NULL, "Hello, World", "Caption", 0)

from one of my languages I can do this if I don't care what the caption is:

messagebox(message:"Hello, World")

The advantages:

* I don't need to remember exact capitalisation (this is thanks to case
insensitivity)

* I don't need to remember the number, position and default values of
every parameter (default values are not part of the sig anyway;
there, I need to read the spec to discover what don't-care values to
provide

With this one, I always have trouble remembering if the caption comes
before or after the main text.

* There is less clutter and less typing

* The call is self-documenting

The only downside is needing to know the names of the parameters.

You will probably say: a good IDE can help with some of this. I will
then say that this is another advantage:

* You don't need an advanced IDE; low-techs tool will work too. You can
even sketch out code with pencil and paper on a beach!

The point really is that it's funny that any C function can be used with
keyword parameters if defined via a binding in another suitable
language, but not from C itself.

---------------
clang func "MessageBoxA" (
ref void hwnd = nil,
ichar message, caption = "Caption",
u32 flags = 0)i32

Note that 'MessageBox' is an alias for MessageBoxA in both languages.

Re: C vs Haskell for XML parsing

<dt2GM.463339$U3w1.15215@fx09.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C vs Haskell for XML parsing
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
Lines: 19
Message-ID: <dt2GM.463339$U3w1.15215@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 25 Aug 2023 13:59:37 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 25 Aug 2023 13:59:37 GMT
X-Received-Bytes: 1768
 by: Scott Lurndal - Fri, 25 Aug 2023 13:59 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>On Friday, 25 August 2023 at 09:50:32 UTC+1, Spiros Bousbouras wrote:
>> On Fri, 25 Aug 2023 01:37:38 -0700 (PDT)
>> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
>> > Of course size_t has an underscore. Everyone knows that. And most people
>> > agree that it is horrible.
>> "Most people" meaning you made it up.
>>
>We could do a straw poll.
>How many people like the underscore in size_t and how many think it is horrible?

I've never heard anyone but you complain about it.

Certainly the dozen or so people that participate in this thread
are hardly a representative sample.

I'd wager that most C programmers don't even think about it, much
less care.

Re: C vs Haskell for XML parsing

<lz2GM.463340$U3w1.382970@fx09.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: C vs Haskell for XML parsing
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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> <87h6onfje9.fsf@nosuchdomain.example.com>
Lines: 32
Message-ID: <lz2GM.463340$U3w1.382970@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 25 Aug 2023 14:06:09 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 25 Aug 2023 14:06:09 GMT
X-Received-Bytes: 2044
 by: Scott Lurndal - Fri, 25 Aug 2023 14:06 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>[...]
>>> The only thing /wrong/ - and pretty much everyone thinks it is wrong -
>>> would be to call it "multiplymatrixwithvector".
>>>
>> Well Caesar disagreed.
>
>Let's drop the lengthy discussions of ancient writing systems, shall we?
>(And David, please stop encouraging them.)
>
>> Denis Ritchie disagreed.
>
>I doubt that. Dennis Ritchie worked in environments that limited
>external identifiers to 6 characters. That's why we have "strcpy",
>not because it's easier to read.

IIRC it was eight characters. The Oracle RDBMS when I worked on
it in the 90's limited all function names to 8 characters for
compatability with the older compilers/linkers. Which made for very
cryptic names.

v7 ld.c:

/* symbol management */
struct symbol {
char sname[8];
char stype;
char spare;
int svalue;
};

Re: C vs Haskell for XML parsing

<ucahoo$1a6u$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 15:35:52 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 47
Message-ID: <ucahoo$1a6u$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<87h6onfje9.fsf@nosuchdomain.example.com>
<lz2GM.463340$U3w1.382970@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Aug 2023 15:35:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9e44805fc081e2430f76c6b244cb706c";
logging-data="43230"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199CP0sermspzH4xqoHUeVZVbL7YEZ1ehc="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:wES8dVYxbViidn6eVNcdTmVRdJ8=
 by: Lew Pitcher - Fri, 25 Aug 2023 15:35 UTC

On Fri, 25 Aug 2023 14:06:09 +0000, Scott Lurndal wrote:

> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>>[...]
>>>> The only thing /wrong/ - and pretty much everyone thinks it is wrong -
>>>> would be to call it "multiplymatrixwithvector".
>>>>
>>> Well Caesar disagreed.
>>
>>Let's drop the lengthy discussions of ancient writing systems, shall we?
>>(And David, please stop encouraging them.)
>>
>>> Denis Ritchie disagreed.
>>
>>I doubt that. Dennis Ritchie worked in environments that limited
>>external identifiers to 6 characters. That's why we have "strcpy",
>>not because it's easier to read.
>
> IIRC it was eight characters.

In Chapter 2 of K&R's "The C Programing Language" (1st edition),
the authors discuss the size of names:
"Only the first eight characters of an internal name are
significant, although more may be used. For external names,
such a function names and external variables, the number may
be less than eight, because external names are used by various
assemblers and loaders."

They go on to list (in Appendix A, "C Reference Manual") the
limits (by implementation) of external identifiers:
"DEC PDP-11 7 characters, 2 cases
Honeywell 6600 6 characters, 1 case
IBM 360/370 7 characters, 1 case
Interdata 8/32 8 characters, 2 cases"
and reiterate that
"No more than the first eight characters are significant,
although more may be used."

So, eight characters was the max for K&R C, with implementations
limiting it to less in many cases.

HTH
--
Lew Pitcher
"In Skills We Trust"

Re: C vs Haskell for XML parsing

<ucaq6u$4q0l$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.brown@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 19:59:58 +0200
Organization: A noiseless patient Spider
Lines: 127
Message-ID: <ucaq6u$4q0l$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<87350dtive.fsf@bsb.me.uk> <ubvan6$1rb3s$1@dont-email.me>
<3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <ucabgk$2691$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Aug 2023 17:59:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c244ea4cca8f9b4180792b6a4896d4d1";
logging-data="157717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187Qk4Q1gV0iDRYIKZ0g5B/KNJXDcvc0+o="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:kVqD4ZC9O4d6/dYmoOCiu8tgeXk=
In-Reply-To: <ucabgk$2691$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Fri, 25 Aug 2023 17:59 UTC

On 25/08/2023 15:49, Bart wrote:
> On 25/08/2023 08:46, David Brown wrote:
>> On 24/08/2023 16:50, Malcolm McLean wrote:
>
>>> Languages that allow named parameters are nice, and if I was extending C
>>> I would introduce that. The problem is that there are a few basic
>>> mathematical
>>> functions like tan() which are conventionally written tan(value), and
>>> that was
>>> then used a model for what other functions would be like. However
>>> only a few
>>> user-written functions calculate similar basic mathematical functions.
>>> Generally it make sense to write payroll(employees=emp, Nemployees=N,
>>> taxcode=1234), not payroll(emp, N, 1234);
>>
>> There are good historical reasons for why named parameters are not
>> common in older languages, but are more common in newer ones.  And
>> there are good technical reasons why they would be difficult to
>> introduce to C as an afterthought.
>
> Which are?

They were not common in older languages because they make the compiler
more complicated, and enforcing them means you need more information
communicated between modules than you get with just a function name in
an assembly file or object file. Thus you need a real "module" system,
which is lacking in C.

They are common in newer languages because they are useful, and we have
fewer limitations on things like compiler sizes and complexity, and can
be more flexible about modules and file formats.

The key technical issue for making it an add-on to C is that C function
declarations and definitions can have different parameter names (see my
other reply on this one).

>
>>   But I agree with you that they can be helpful and improve code
>> readability, in languages that support them.
>
> Actually, when I call functions defined via a C header via my FFI, I can
> apply keyword parameters if I want, /and/ define default values for
> missing arguments. They don't need to be written in one of those languages.
>

Yes, that would seem reasonable - you have a wrapper in your own
language, and use whatever features your own language supports.

> So whereas in C I have to write this:
>
>     MessageBox(NULL, "Hello, World", "Caption", 0)
>
> from one of my languages I can do this if I don't care what the caption is:
>
>     messagebox(message:"Hello, World")
>
> The advantages:
>
> * I don't need to remember exact capitalisation (this is thanks to case
>   insensitivity)

(That is not an advantage, IMHO - it is a disadvantage. But let's not
get into that again - certainly it makes sense for the wrappers to use
the same conventions as the rest of your language, not the conventions
of the language being called.)

>
> * I don't need to remember the number, position and default values of
>   every parameter (default values are not part of the sig anyway;
>   there, I need to read the spec to discover what don't-care values to
>   provide
>
>   With this one, I always have trouble remembering if the caption comes
>   before or after the main text.

Yes, that's the point of named parameters.

>
> * There is less clutter and less typing

Named parameters are /more/ typing, not less - but it is useful
additional typing.

>
> * The call is self-documenting

Ha! The myth of self-documenting code never dies - every programmer of
every language thinks their own code is so clear it doesn't need
additional documentation.

But named parameters can certainly make code less cryptic.

>
> The only downside is needing to know the names of the parameters.
>
> You will probably say: a good IDE can help with some of this.

I wasn't going to say it, but it is true :-)

> I will
> then say that this is another advantage:
>
> * You don't need an advanced IDE; low-techs tool will work too. You can
>   even sketch out code with pencil and paper on a beach!

I agree - you don't /need/ a good IDE for any programming. But often it
helps.

>
> The point really is that it's funny that any C function can be used with
> keyword parameters if defined via a binding in another suitable
> language, but not from C itself.

That's not remotely surprising.

But to be clear, I think it's nice that you support named parameters in
your language.

>
> ---------------
> clang func "MessageBoxA" (
>     ref void hwnd = nil,
>     ichar message, caption = "Caption",
>     u32 flags = 0)i32
>
> Note that 'MessageBox' is an alias for MessageBoxA in both languages.

Re: C vs Haskell for XML parsing

<20230825110216.153@kylheku.com>

  copy mid

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

  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-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 18:31:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 106
Message-ID: <20230825110216.153@kylheku.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<87350dtive.fsf@bsb.me.uk> <ubvan6$1rb3s$1@dont-email.me>
<3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <ucabgk$2691$1@dont-email.me>
<ucaq6u$4q0l$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Aug 2023 18:31:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="da362067bb31f42f1d40f21531177749";
logging-data="173761"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18o09G4f488NPwKrNYnZbr68PCq9ITvixs="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:vHmBROq27uQ117qtMBzepkrm1ds=
 by: Kaz Kylheku - Fri, 25 Aug 2023 18:31 UTC

On 2023-08-25, David Brown <david.brown@hesbynett.no> wrote:
> On 25/08/2023 15:49, Bart wrote:
>> On 25/08/2023 08:46, David Brown wrote:
>>> On 24/08/2023 16:50, Malcolm McLean wrote:
>>>
>>> There are good historical reasons for why named parameters are not
>>> common in older languages, but are more common in newer ones.  And
>>> there are good technical reasons why they would be difficult to
>>> introduce to C as an afterthought.
>>
>> Which are?
>
> They were not common in older languages because they make the compiler
> more complicated, and enforcing them means you need more information
> communicated between modules than you get with just a function name in
> an assembly file or object file. Thus you need a real "module" system,
> which is lacking in C.

Namde parameters are not common in older languages, because it
didn't occur to people at the time.

Functions are inspired by mathematics, and you don't encounter
anything like named parameters in common math. It's always f(a, b)
not f(x: a, y: b).

Even if you hit upon the idea, it's not obvious that it's an
improvement.

You need to have had experience working in very large code bases
with vast numbers of API's with mixed conventions.

Even then, you might not find named arguments appealing due to the
verbosity.

You might not find naed arguments appealing due to real technical
issues too.

Suppose you have a language in which the model of a function call
is that "expressions are evaluated in left to right order (or right to
left) and pushed on the stack in that order".

If you throw in named arguments into the mix, what happens to
the eval order? Do you preserve the written order, or do you
transform the function call according to the names into the function
call that doesn't use names?

Preserving the written order means temporary variables: you need a
better compiler to eliminate them. Rearranging the order to match
the underlying positiona argument order leads to surprising
behaviors when the argument expressions have side effects.

Specifically in C, we don't have a required evaluation order. But
still, typically, it has been historically predictable in specific
compilers.

Speaking of layering, there is the fact that the underlying function
call mechanism does not itself use the names. (There are languages
with keyword arguments, like Common Lisp and Python, where the
callee receives the keywords; I'm not writing about that.)

The named arguments are transformed a function call which just passes
the arguents by position.

So any way you look at it, named arguments are an extra layer of fluff
that is optional, and that is firmly understood in terms of a function
call without named parameters.

Named arguments can lead to the following unintended harm.
Regular, unnamed positional arguments tend to discourage the
proliferation of API's with large numbers of parameters.

With named parameters (especially if some parameters can be optional)
it's possible to abandon the pressure to reduce the number of
parameters that makes for better API design.

The named arguments become the API, and that API is no longer workable
without named arguments.

> The key technical issue for making it an add-on to C is that C function
> declarations and definitions can have different parameter names (see my
> other reply on this one).

That is actually fine because the caller would just use the declaration
that it has. It's just as syntactic sugar that plays out at the call
site, that the callee has no knowledge about.

When a function is redeclared, the names could be composed together
as follows: if both declarations name a parameter, the most recent
one wins. If only one of them names the parameter, that is the name.

Here is the problem: if duplicat names result, it is a diagnosable
error, e.g.:

void foo(int x, int);

void foo(int, int x);

Since this is currently valid code, the rule would probably have to be
that the most recent declaration completely replaces the name list; the
name of the leftmost parameter becomes unavailable due to the second
redeclaration.

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

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

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 11:45:24 -0700
Organization: None to speak of
Lines: 52
Message-ID: <87cyzbezaz.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<87h6onfje9.fsf@nosuchdomain.example.com>
<lz2GM.463340$U3w1.382970@fx09.iad> <ucahoo$1a6u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ff9dd3ab6456b7662552a3d71d7486d3";
logging-data="176259"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eXUhbnGp+CEMs2pxEgyH+"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:M3RVm+7clbrnsP7FnEzwpR+/0sA=
sha1:qPz2I4Y3sgqWe0dpK6X8NGg0xdc=
 by: Keith Thompson - Fri, 25 Aug 2023 18:45 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
> On Fri, 25 Aug 2023 14:06:09 +0000, Scott Lurndal wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>>>[...]
>>>>> The only thing /wrong/ - and pretty much everyone thinks it is wrong -
>>>>> would be to call it "multiplymatrixwithvector".
>>>>>
>>>> Well Caesar disagreed.
>>>
>>>Let's drop the lengthy discussions of ancient writing systems, shall we?
>>>(And David, please stop encouraging them.)
>>>
>>>> Denis Ritchie disagreed.
>>>
>>>I doubt that. Dennis Ritchie worked in environments that limited
>>>external identifiers to 6 characters. That's why we have "strcpy",
>>>not because it's easier to read.
>>
>> IIRC it was eight characters.
>
> In Chapter 2 of K&R's "The C Programing Language" (1st edition),
> the authors discuss the size of names:
> "Only the first eight characters of an internal name are
> significant, although more may be used. For external names,
> such a function names and external variables, the number may
> be less than eight, because external names are used by various
> assemblers and loaders."
>
> They go on to list (in Appendix A, "C Reference Manual") the
> limits (by implementation) of external identifiers:
> "DEC PDP-11 7 characters, 2 cases
> Honeywell 6600 6 characters, 1 case
> IBM 360/370 7 characters, 1 case
> Interdata 8/32 8 characters, 2 cases"
> and reiterate that
> "No more than the first eight characters are significant,
> although more may be used."
>
> So, eight characters was the max for K&R C, with implementations
> limiting it to less in many cases.

For K&R C, the limit was 8 for *internal* identifiers. The limit for
external identifiers (like strcpy) was what we'd now call
implementation-defined, with at least one implementation imposing a
limit of 6 (and not distinguishing between foobar and FOOBAR).

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

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

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 19:50:28 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <87pm3bot1n.fsf@bsb.me.uk>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<j=2ifExxFfXU05g0F@bongo-ra.co>
<ae3d2d4e-71bd-4c6c-99aa-cf8b6b652175n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="db502f07399a680d9ab33d740f6bcf53";
logging-data="166351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+XOI62WvCNfzOsQvR6qKuWl3oSusNFzE="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:qjLRYoxhVZd1gmmL9yw4ctw8OeA=
sha1:lrN4b4vdHVcGHdyq1K0lMXoaN8w=
X-BSB-Auth: 1.6ea24a5dd1645d9ba1d3.20230825195028BST.87pm3bot1n.fsf@bsb.me.uk
 by: Ben Bacarisse - Fri, 25 Aug 2023 18:50 UTC

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

> On Friday, 25 August 2023 at 09:50:32 UTC+1, Spiros Bousbouras wrote:
>> On Fri, 25 Aug 2023 01:37:38 -0700 (PDT)
>> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
>> > Of course size_t has an underscore. Everyone knows that. And most people
>> > agree that it is horrible.
>> "Most people" meaning you made it up.
>>
> We could do a straw poll.
> How many people like the underscore in size_t and how many think it is
> horrible?

Did you really just set up a false dichotomy to try to tip the results?
The question should be simply whether you agree that it's horrible or
not. You don't have to actually like it to not agree that it's
horrible.

--
Ben.

Re: C vs Haskell for XML parsing

<878r9zeynn.fsf@nosuchdomain.example.com>

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 11:59:24 -0700
Organization: None to speak of
Lines: 48
Message-ID: <878r9zeynn.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ff9dd3ab6456b7662552a3d71d7486d3";
logging-data="183471"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PYChOmqvzBuVT4sHI7b5J"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:YybO+7yVPeK7kljopmMDt/hnGrk=
sha1:5O8rK1GumCZTrIPQpW2mnvPmANY=
 by: Keith Thompson - Fri, 25 Aug 2023 18:59 UTC

David Brown <david.brown@hesbynett.no> writes:
> On 25/08/2023 10:37, Malcolm McLean wrote:
>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
[...]
>>> There are good historical reasons for why named parameters are not
>>> common in older languages, but are more common in newer ones. And there
>>> are good technical reasons why they would be difficult to introduce to C
>>> as an afterthought. But I agree with you that they can be helpful and
>>> improve code readability, in languages that support them.
>>>
>> I don't really see what the technical problem is. The header would have to
>> contain the names of the parameters (most do already). Then instead
>> of putting parameter 1 into register a and parameter 2 into register b,
>> the compiler matches them up. If its void foo(int x, int y) and the
>> call is foo(y=1, x=2), then the compiler puts a 2 into register a and a 1
>> into register b.
>> I haven't tried to modify a compiler to do this so there might be something I
>> haven't thought of. But it would be a fairly simple, contained change with no
>> implications for the linker.
>
> The key technical problem for C is that the parameter names are not
> part of the signature of the function. It is not uncommon for
> declarations to have missing parameter names, or different names from
> those uses in the definition of the function. (Sometimes there are
> good reasons for this, sometimes it is laziness.) If a function is
> defined as "void foo(int a, int b) { .. }", but the declaration used
> to call it has "void foo(int b, int a);", then how should named
> parameters be resolved?
>
> Any resolution here would place restrictions on which functions could
> support named parameters - such as consistent declarations and
> definitions, but it would be impossible (in general) to check them.

Any parameter names in a call would just have to be consistent with the
names in the visible prototype. I don't see a problem.

Using the "name=value" syntax would conflict with the use of an
assignment expression as an argument, so some new syntax would have to
be invented.

I know, we could reuse the "static" keyword! 8-)}

[...]

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

<ucb1ji$4q37$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 20:06:10 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 82
Message-ID: <ucb1ji$4q37$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@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>
<87h6onfje9.fsf@nosuchdomain.example.com>
<lz2GM.463340$U3w1.382970@fx09.iad> <ucahoo$1a6u$1@dont-email.me>
<87cyzbezaz.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 25 Aug 2023 20:06:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9e44805fc081e2430f76c6b244cb706c";
logging-data="157799"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eOxq2F4h36eJ7HfIJ61SQtJ7DT8/vp8A="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:03apVPOA021u1ZfsN/4hfEwT2k4=
 by: Lew Pitcher - Fri, 25 Aug 2023 20:06 UTC

On Fri, 25 Aug 2023 11:45:24 -0700, Keith Thompson wrote:

> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>> On Fri, 25 Aug 2023 14:06:09 +0000, Scott Lurndal wrote:
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>>Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>>>>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>>>>[...]
>>>>>> The only thing /wrong/ - and pretty much everyone thinks it is wrong -
>>>>>> would be to call it "multiplymatrixwithvector".
>>>>>>
>>>>> Well Caesar disagreed.
>>>>
>>>>Let's drop the lengthy discussions of ancient writing systems, shall we?
>>>>(And David, please stop encouraging them.)
>>>>
>>>>> Denis Ritchie disagreed.
>>>>
>>>>I doubt that. Dennis Ritchie worked in environments that limited
>>>>external identifiers to 6 characters. That's why we have "strcpy",
>>>>not because it's easier to read.
>>>
>>> IIRC it was eight characters.
>>
>> In Chapter 2 of K&R's "The C Programing Language" (1st edition),
>> the authors discuss the size of names:
>> "Only the first eight characters of an internal name are
>> significant, although more may be used. For external names,
>> such a function names and external variables, the number may
>> be less than eight, because external names are used by various
>> assemblers and loaders."
>>
>> They go on to list (in Appendix A, "C Reference Manual") the
>> limits (by implementation) of external identifiers:
>> "DEC PDP-11 7 characters, 2 cases
>> Honeywell 6600 6 characters, 1 case
>> IBM 360/370 7 characters, 1 case
>> Interdata 8/32 8 characters, 2 cases"
>> and reiterate that
>> "No more than the first eight characters are significant,
>> although more may be used."
>>
>> So, eight characters was the max for K&R C, with implementations
>> limiting it to less in many cases.
>
> For K&R C, the limit was 8 for *internal* identifiers.

I believe that the limit was 8 for /all/ identifiers, with two caveats
1) names could be longer, but only the first 8 characters were
significant, and
2) extern identifiers were often limited by the operating environment
(likely the limits of the assembler[1] or linker) to less than the 8
significant characters that the parser recognized.

> The limit for
> external identifiers (like strcpy) was what we'd now call
> implementation-defined, with at least one implementation imposing a
> limit of 6 (and not distinguishing between foobar and FOOBAR).

While I agree that the length of extern identifiers would have been
called "implementation defined", I don't think that the lengths could
exceed the 8 significant character maximum imposed by the compiler.
In other words, a K&R C compiler wouldn't allow (for instance) a 10
significant character extern identifier.

[1] Section 2.1 "Identifiers" of the "UNIX Assembler Reference Manual"
says that
"An identifier consists of a sequence of alphanumeric characters
... of which the first may not be numeric. Only the first eight
characters are significant."
The toolchain was source -> compile -> assemble -> link -> binary
and the assembler was (and usually still is) a critical part of
that chain. If the /assembler/ limits labels to 8 significant
characters, then the language has to either accomodate that
limitation, or find a kluge around it. It looks like Ritchie
et al stuck with the assembler limits here.

Just my 2 cents worth.
--
Lew Pitcher
"In Skills We Trust"

Re: C vs Haskell for XML parsing

<AUaGM.174236$JG_b.91752@fx39.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx39.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: C vs Haskell for XML parsing
Content-Language: en-US
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
From: Richard@Damon-Family.org (Richard Damon)
In-Reply-To: <878r9zeynn.fsf@nosuchdomain.example.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 59
Message-ID: <AUaGM.174236$JG_b.91752@fx39.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 25 Aug 2023 19:34:56 -0400
X-Received-Bytes: 4658
 by: Richard Damon - Fri, 25 Aug 2023 23:34 UTC

On 8/25/23 2:59 PM, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
>> On 25/08/2023 10:37, Malcolm McLean wrote:
>>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
> [...]
>>>> There are good historical reasons for why named parameters are not
>>>> common in older languages, but are more common in newer ones. And there
>>>> are good technical reasons why they would be difficult to introduce to C
>>>> as an afterthought. But I agree with you that they can be helpful and
>>>> improve code readability, in languages that support them.
>>>>
>>> I don't really see what the technical problem is. The header would have to
>>> contain the names of the parameters (most do already). Then instead
>>> of putting parameter 1 into register a and parameter 2 into register b,
>>> the compiler matches them up. If its void foo(int x, int y) and the
>>> call is foo(y=1, x=2), then the compiler puts a 2 into register a and a 1
>>> into register b.
>>> I haven't tried to modify a compiler to do this so there might be something I
>>> haven't thought of. But it would be a fairly simple, contained change with no
>>> implications for the linker.
>>
>> The key technical problem for C is that the parameter names are not
>> part of the signature of the function. It is not uncommon for
>> declarations to have missing parameter names, or different names from
>> those uses in the definition of the function. (Sometimes there are
>> good reasons for this, sometimes it is laziness.) If a function is
>> defined as "void foo(int a, int b) { .. }", but the declaration used
>> to call it has "void foo(int b, int a);", then how should named
>> parameters be resolved?
>>
>> Any resolution here would place restrictions on which functions could
>> support named parameters - such as consistent declarations and
>> definitions, but it would be impossible (in general) to check them.
>
> Any parameter names in a call would just have to be consistent with the
> names in the visible prototype. I don't see a problem.
>
> Using the "name=value" syntax would conflict with the use of an
> assignment expression as an argument, so some new syntax would have to
> be invented.
>
> I know, we could reuse the "static" keyword! 8-)}
>
> [...]
>

As far as I know, C could still adopt the use of : for this purpose,
like Bart's language does.

I can't think of anything that this would get confused with.

I think the biggest thing this would require is that every standard
library function would need to have the name used for its parameter
defined (or the standard say you can't portably use them with the
standard library functions.

I think the biggest issue there is that the names would need to be
somewhat ugle as they would need to be in the implementation reserved
namespace, as anything in the user namespace might be a macro

Re: C vs Haskell for XML parsing

<874jkmfyqp.fsf@nosuchdomain.example.com>

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 17:12:14 -0700
Organization: None to speak of
Lines: 52
Message-ID: <874jkmfyqp.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1a7ecb700a546ba1326d8f9e5790cb8d";
logging-data="282874"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+n4ylMZ6cEGLIPm8xxahVE"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:38ocC8IN6McQhNhMoUkRYvMqNsQ=
sha1:N2NpoqWZfT+ZcqY0q3TrrMc96qc=
 by: Keith Thompson - Sat, 26 Aug 2023 00:12 UTC

Richard Damon <Richard@Damon-Family.org> writes:
> On 8/25/23 2:59 PM, Keith Thompson wrote:
[...]
>> Any parameter names in a call would just have to be consistent with
>> the names in the visible prototype. I don't see a problem. Using
>> the "name=value" syntax would conflict with the use of an assignment
>> expression as an argument, so some new syntax would have to be
>> invented.
>>
>> I know, we could reuse the "static" keyword! 8-)}
>> [...]
>>
>
> As far as I know, C could still adopt the use of : for this purpose,
> like Bart's language does.
>
> I can't think of anything that this would get confused with.

Nor can I.

> I think the biggest thing this would require is that every standard
> library function would need to have the name used for its parameter
> defined (or the standard say you can't portably use them with the
> standard library functions.

The standard already shows parameter names for library functions, though
they're not currently semantically meaningful. If this feature were
added in a future standard, the same names could be used.

> I think the biggest issue there is that the names would need to be
> somewhat ugle as they would need to be in the implementation reserved
> namespace, as anything in the user namespace might be a macro

I'm not sure that would be much of a problem. For example, given
char *strcpy(char * restrict s1,
const char * restrict s2);
and a call like:
strcpy(s1: foo, s2: bar);
the lookup for the names s1 and s2 would refer only to the named
parameters of the called function. If you define a macro "s1", you
simply get whatever it expands to.

Another issue is that library functions can additionally be defined as
macros. One solution would be to say that if you use a named parameter
association, it bypasses the macro and calls the function -- which could
break some contrived macro invocations. Another would be to allow named
parameter associations for macro invocations as well as function calls.

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

<878r9ypr8v.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Sat, 26 Aug 2023 01:44:00 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <878r9ypr8v.fsf@bsb.me.uk>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad>
<874jkmfyqp.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="434cbeb9369d4b40e035757a11661018";
logging-data="291510"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197sYHJd0FOx2e7uSWhzngrZAbzfrw335M="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:2lT564wb3jcALiQWCTPFmDIqMaU=
sha1:Fh3ypuoz0VJFzjKoPQLmVz0Xfa8=
X-BSB-Auth: 1.530c58e31d3efc29949f.20230826014400BST.878r9ypr8v.fsf@bsb.me.uk
 by: Ben Bacarisse - Sat, 26 Aug 2023 00:44 UTC

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

> Another issue is that library functions can additionally be defined as
> macros. One solution would be to say that if you use a named parameter
> association, it bypasses the macro and calls the function -- which could
> break some contrived macro invocations. Another would be to allow named
> parameter associations for macro invocations as well as function
> calls.

Or, if you implement it for macros, you don't need to implement it for
functions. It's probably best to do both, but one can image a trial
implementation using just the pre-processor.

--
Ben.

Re: C vs Haskell for XML parsing

<ucbjph$96fa$1@dont-email.me>

  copy mid

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

  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: Sat, 26 Aug 2023 02:16:33 +0100
Organization: A noiseless patient Spider
Lines: 112
Message-ID: <ucbjph$96fa$1@dont-email.me>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 26 Aug 2023 01:16:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a7a2d425f9dd65d0686e9bfc0219a30a";
logging-data="301546"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rZC+Yt9mSPnphtweNrkjbMBBhkJqecbs="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:6jZxbSgvX0L3xqpRWKmvlOIQMl4=
In-Reply-To: <AUaGM.174236$JG_b.91752@fx39.iad>
 by: Bart - Sat, 26 Aug 2023 01:16 UTC

On 26/08/2023 00:34, Richard Damon wrote:
> On 8/25/23 2:59 PM, Keith Thompson wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>> On 25/08/2023 10:37, Malcolm McLean wrote:
>>>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>> [...]
>>>>> There are good historical reasons for why named parameters are not
>>>>> common in older languages, but are more common in newer ones. And
>>>>> there
>>>>> are good technical reasons why they would be difficult to introduce
>>>>> to C
>>>>> as an afterthought. But I agree with you that they can be helpful and
>>>>> improve code readability, in languages that support them.
>>>>>
>>>> I don't really see what the technical problem is. The header would
>>>> have to
>>>> contain the names of the parameters (most do already). Then instead
>>>> of putting parameter 1 into register a and parameter 2 into register b,
>>>> the compiler matches them up. If its void foo(int x, int y) and the
>>>> call is foo(y=1, x=2), then the compiler puts a 2 into register a
>>>> and a 1
>>>> into register b.
>>>> I haven't tried to modify a compiler to do this so there might be
>>>> something I
>>>> haven't thought of. But it would be a fairly simple, contained
>>>> change with no
>>>> implications for the linker.
>>>
>>> The key technical problem for C is that the parameter names are not
>>> part of the signature of the function.  It is not uncommon for
>>> declarations to have missing parameter names, or different names from
>>> those uses in the definition of the function.  (Sometimes there are
>>> good reasons for this, sometimes it is laziness.)  If a function is
>>> defined as "void foo(int a, int b) { .. }", but the declaration used
>>> to call it has "void foo(int b, int a);", then how should named
>>> parameters be resolved?
>>>
>>> Any resolution here would place restrictions on which functions could
>>> support named parameters - such as consistent declarations and
>>> definitions, but it would be impossible (in general) to check them.
>>
>> Any parameter names in a call would just have to be consistent with the
>> names in the visible prototype.  I don't see a problem.
>>
>> Using the "name=value" syntax would conflict with the use of an
>> assignment expression as an argument, so some new syntax would have to
>> be invented.
>>
>> I know, we could reuse the "static" keyword!  8-)}
>>
>> [...]
>>
>
> As far as I know, C could still adopt the use of : for this purpose,
> like Bart's language does.

"." is already used by C for designated initialisers for structs. Why
not just use that?

>
> I can't think of anything that this would get confused with.
>
> I think the biggest thing this would require is that every standard
> library function would need to have the name used for its parameter
> defined (or the standard say you can't portably use them with the
> standard library functions.
>
> I think the biggest issue there is that the names would need to be
> somewhat ugle as they would need to be in the implementation reserved
> namespace, as anything in the user namespace might be a macro

So, if a function uses x and y parameters, they can clash with
user-defined macros called 'x' and 'y'?

But, this is already going to be a problem with arbitrarily named
functions in a library, plus variables, types, enums and macros exported
from that library.

If every such parameter name is to be uglified, then there seems little
point.

One possible answer might be a new kind of token which is
".alphanumeric", where the alphanumeric part is not checked for macro
expansion.

BTW I hadn't considered the macro angle. I tried the example below (in
my language), and it worked as expected, but then my macros are expanded
at a later stage than in C, so in the context of the keyword:value pair
'x:37', 'x' is a not a candidate for expansion.

A potentially bigger problem in C is how to deal with default parameter
values which is an essential part of keyword parameters. Especially
regarding the lexical scope of the names used in the default value
expression.

-----------------------------

macro x=999

proc bill(int x=10)=
println x
end

proc main=
bill() # output 10
bill(x:37) # output 37
bill(x) # output 999
bill(x:x) # output 999
end

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 18:39:29 -0700
Organization: None to speak of
Lines: 41
Message-ID: <87zg2eeg4u.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1a7ecb700a546ba1326d8f9e5790cb8d";
logging-data="431470"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180dsRkGUF/HZ1HH3FzuJOz"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:bTfvSduGr7kg6TUjnPmDe9NX5hA=
sha1:Zh60nCmiehlmEZ0oHWI9rFUW8yg=
 by: Keith Thompson - Sat, 26 Aug 2023 01:39 UTC

Bart <bc@freeuk.com> writes:
> On 26/08/2023 00:34, Richard Damon wrote:
[...]
>> As far as I know, C could still adopt the use of : for this purpose,
>> like Bart's language does.
>
> "." is already used by C for designated initialisers for structs. Why
> not just use that?

It would probably work, but I dislike it. In a designated initializer,
the ".foo = 42" syntax mirrors the "obj.foo" syntax for referring to a
member of a struct object, just as "[0] = 42" mirrors the "obj[0]"
syntax.

Using ":" IMHO looks nice, and doesn't clash with anything else.

Ada uses "=>", which could also work. (Python uses "=", which it can do
because it doesn't use "=" for assignment expressions.)

Not a huge deal either way.

For that matter, a future C *could* use "=" as long as it disallowed
assigment expressions as arguments. That would be in some sense
cleaner, since it would suggest the assignment of an argument value to a
parameter, but it would break some existing code, and could even change
the meaning of some code that's currently valid but contrived.

[...]

> One possible answer might be a new kind of token which is
> ".alphanumeric", where the alphanumeric part is not checked for macro
> expansion.

But ".alphanumeric" is already two tokens that can appear together.

[...]

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

<yhdGM.457100$xMqa.361350@fx12.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: C vs Haskell for XML parsing
Content-Language: en-US
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <874jkmfyqp.fsf@nosuchdomain.example.com>
From: Richard@Damon-Family.org (Richard Damon)
In-Reply-To: <874jkmfyqp.fsf@nosuchdomain.example.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 64
Message-ID: <yhdGM.457100$xMqa.361350@fx12.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 25 Aug 2023 22:18:06 -0400
X-Received-Bytes: 4498
 by: Richard Damon - Sat, 26 Aug 2023 02:18 UTC

On 8/25/23 8:12 PM, Keith Thompson wrote:
> Richard Damon <Richard@Damon-Family.org> writes:
>> On 8/25/23 2:59 PM, Keith Thompson wrote:
> [...]
>>> Any parameter names in a call would just have to be consistent with
>>> the names in the visible prototype. I don't see a problem. Using
>>> the "name=value" syntax would conflict with the use of an assignment
>>> expression as an argument, so some new syntax would have to be
>>> invented.
>>>
>>> I know, we could reuse the "static" keyword! 8-)}
>>> [...]
>>>
>>
>> As far as I know, C could still adopt the use of : for this purpose,
>> like Bart's language does.
>>
>> I can't think of anything that this would get confused with.
>
> Nor can I.
>
>> I think the biggest thing this would require is that every standard
>> library function would need to have the name used for its parameter
>> defined (or the standard say you can't portably use them with the
>> standard library functions.
>
> The standard already shows parameter names for library functions, though
> they're not currently semantically meaningful. If this feature were
> added in a future standard, the same names could be used.
>
>> I think the biggest issue there is that the names would need to be
>> somewhat ugle as they would need to be in the implementation reserved
>> namespace, as anything in the user namespace might be a macro
>
> I'm not sure that would be much of a problem. For example, given
> char *strcpy(char * restrict s1,
> const char * restrict s2);
> and a call like:
> strcpy(s1: foo, s2: bar);
> the lookup for the names s1 and s2 would refer only to the named
> parameters of the called function. If you define a macro "s1", you
> simply get whatever it expands to.
>
> Another issue is that library functions can additionally be defined as
> macros. One solution would be to say that if you use a named parameter
> association, it bypasses the macro and calls the function -- which could
> break some contrived macro invocations. Another would be to allow named
> parameter associations for macro invocations as well as function calls.
>

The problem would be needing to completely throw out the existing phases
of translation.

For instance, a translation unit is allowed to have defined something like:

#define s1 x+y(

before including the system headers. so to ignore that macro in that
context, would need a complete change in how the preprocessor works.

The fact that s1 is in the user namespace says the header can't actually
have used that name.

This is why actual headers are filled with names that begin with underscores

Re: C vs Haskell for XML parsing

<ipdGM.457101$xMqa.238959@fx12.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: C vs Haskell for XML parsing
Content-Language: en-US
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
From: Richard@Damon-Family.org (Richard Damon)
In-Reply-To: <ucbjph$96fa$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 138
Message-ID: <ipdGM.457101$xMqa.238959@fx12.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 25 Aug 2023 22:26:22 -0400
X-Received-Bytes: 7181
 by: Richard Damon - Sat, 26 Aug 2023 02:26 UTC

On 8/25/23 9:16 PM, Bart wrote:
> On 26/08/2023 00:34, Richard Damon wrote:
>> On 8/25/23 2:59 PM, Keith Thompson wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>> On 25/08/2023 10:37, Malcolm McLean wrote:
>>>>> On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>>> [...]
>>>>>> There are good historical reasons for why named parameters are not
>>>>>> common in older languages, but are more common in newer ones. And
>>>>>> there
>>>>>> are good technical reasons why they would be difficult to
>>>>>> introduce to C
>>>>>> as an afterthought. But I agree with you that they can be helpful and
>>>>>> improve code readability, in languages that support them.
>>>>>>
>>>>> I don't really see what the technical problem is. The header would
>>>>> have to
>>>>> contain the names of the parameters (most do already). Then instead
>>>>> of putting parameter 1 into register a and parameter 2 into
>>>>> register b,
>>>>> the compiler matches them up. If its void foo(int x, int y) and the
>>>>> call is foo(y=1, x=2), then the compiler puts a 2 into register a
>>>>> and a 1
>>>>> into register b.
>>>>> I haven't tried to modify a compiler to do this so there might be
>>>>> something I
>>>>> haven't thought of. But it would be a fairly simple, contained
>>>>> change with no
>>>>> implications for the linker.
>>>>
>>>> The key technical problem for C is that the parameter names are not
>>>> part of the signature of the function.  It is not uncommon for
>>>> declarations to have missing parameter names, or different names from
>>>> those uses in the definition of the function.  (Sometimes there are
>>>> good reasons for this, sometimes it is laziness.)  If a function is
>>>> defined as "void foo(int a, int b) { .. }", but the declaration used
>>>> to call it has "void foo(int b, int a);", then how should named
>>>> parameters be resolved?
>>>>
>>>> Any resolution here would place restrictions on which functions could
>>>> support named parameters - such as consistent declarations and
>>>> definitions, but it would be impossible (in general) to check them.
>>>
>>> Any parameter names in a call would just have to be consistent with the
>>> names in the visible prototype.  I don't see a problem.
>>>
>>> Using the "name=value" syntax would conflict with the use of an
>>> assignment expression as an argument, so some new syntax would have to
>>> be invented.
>>>
>>> I know, we could reuse the "static" keyword!  8-)}
>>>
>>> [...]
>>>
>>
>> As far as I know, C could still adopt the use of : for this purpose,
>> like Bart's language does.
>
> "." is already used by C for designated initialisers for structs. Why
> not just use that?

That could work too.

It still have the macro problem (at least for standard headers)

>
>>
>> I can't think of anything that this would get confused with.
>>
>> I think the biggest thing this would require is that every standard
>> library function would need to have the name used for its parameter
>> defined (or the standard say you can't portably use them with the
>> standard library functions.
>>
>> I think the biggest issue there is that the names would need to be
>> somewhat ugle as they would need to be in the implementation reserved
>> namespace, as anything in the user namespace might be a macro
>
> So, if a function uses x and y parameters, they can clash with
> user-defined macros called 'x' and 'y'?

Of course, C macros are global substitutes.

>
> But, this is already going to be a problem with arbitrarily named
> functions in a library, plus variables, types, enums and macros exported
> from that library.

If the header defines that the indentifies are reserved for its us, then
the user code won't (or shouldn't) define macros for them.

>
> If every such parameter name is to be uglified, then there seems little
> point.

Yes, that was my point for system headers. You would need something like:

strcpy(_Src: p1, _Dst: p2);

since those are reserved names for the implementation.

>
> One possible answer might be a new kind of token which is
> ".alphanumeric", where the alphanumeric part is not checked for macro
> expansion.

except that would impact something like x.y where you may WANT to have a
macro for the y part.

>
>
> BTW I hadn't considered the macro angle. I tried the example below (in
> my language), and it worked as expected, but then my macros are expanded
> at a later stage than in C, so in the context of the keyword:value pair
> 'x:37', 'x' is a not a candidate for expansion.
>
> A potentially bigger problem in C is how to deal with default parameter
> values which is an essential part of keyword parameters. Especially
> regarding the lexical scope of the names used in the default value
> expression.
>
> -----------------------------
>
>     macro x=999
>
>     proc bill(int x=10)=
>         println x
>     end
>
>     proc main=
>         bill()                # output 10
>         bill(x:37)            # output 37
>         bill(x)               # output 999
>         bill(x:x)             # output 999
>     end
>
>

Re: C vs Haskell for XML parsing

<a196bf8d-9613-4ff3-ac60-6c8e192b8c7an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:4a4e:b0:649:90b5:69a0 with SMTP id ph14-20020a0562144a4e00b0064990b569a0mr419322qvb.6.1693017306693;
Fri, 25 Aug 2023 19:35:06 -0700 (PDT)
X-Received: by 2002:a05:6a00:22c7:b0:68a:33fc:a094 with SMTP id
f7-20020a056a0022c700b0068a33fca094mr8151791pfj.3.1693017306117; Fri, 25 Aug
2023 19:35:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 25 Aug 2023 19:35:05 -0700 (PDT)
In-Reply-To: <87h6onfje9.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5f9:166e:840e:d1f9;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5f9:166e:840e:d1f9
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvan6$1rb3s$1@dont-email.me> <3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me> <e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me> <b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me> <d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me> <d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me> <1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me> <81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me> <8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<87h6onfje9.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a196bf8d-9613-4ff3-ac60-6c8e192b8c7an@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Sat, 26 Aug 2023 02:35:06 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Malcolm McLean - Sat, 26 Aug 2023 02:35 UTC

On Friday, 25 August 2023 at 12:31:44 UTC+1, Keith Thompson wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> writes:
> > On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
> [...]
> >> The only thing /wrong/ - and pretty much everyone thinks it is wrong -
> >> would be to call it "multiplymatrixwithvector".
> >>
> > Well Caesar disagreed.
> Let's drop the lengthy discussions of ancient writing systems, shall we?
> (And David, please stop encouraging them.)
>
> > Denis Ritchie disagreed.
>
> I doubt that. Dennis Ritchie worked in environments that limited
> external identifiers to 6 characters. That's why we have "strcpy",
> not because it's easier to read.
>
However that's not the explanation for isdigit() rather than is_digit().

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 19:55:38 -0700
Organization: None to speak of
Lines: 31
Message-ID: <87v8d2eclx.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me>
<e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me>
<b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me>
<d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me>
<d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me>
<1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me>
<81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me>
<8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me>
<639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me>
<d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<87h6onfje9.fsf@nosuchdomain.example.com>
<a196bf8d-9613-4ff3-ac60-6c8e192b8c7an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1a7ecb700a546ba1326d8f9e5790cb8d";
logging-data="450843"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RowaLMXzkZv/Z+RisN2b2"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:KIMuZtOApwbEN4k9KIIZtERhD7A=
sha1:TkbGd9bHQxj1x1EDhwzGnLoHk/k=
 by: Keith Thompson - Sat, 26 Aug 2023 02:55 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> On Friday, 25 August 2023 at 12:31:44 UTC+1, Keith Thompson wrote:
>> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>> > On Friday, 25 August 2023 at 08:46:22 UTC+1, David Brown wrote:
>> [...]
>> >> The only thing /wrong/ - and pretty much everyone thinks it is wrong -
>> >> would be to call it "multiplymatrixwithvector".
>> >>
>> > Well Caesar disagreed.
>> Let's drop the lengthy discussions of ancient writing systems, shall we?
>> (And David, please stop encouraging them.)
>>
>> > Denis Ritchie disagreed.
>>
>> I doubt that. Dennis Ritchie worked in environments that limited
>> external identifiers to 6 characters. That's why we have "strcpy",
>> not because it's easier to read.
>>
> However that's not the explanation for isdigit() rather than is_digit().

I should have said 6 *significant* characters, so is_digit and
is_digest might be treated as the same identifier. The early limits
on external identifiers forced terse names for library functions.
Adding underscores for only some function names would not have been
helpful. (I haven't checked whether any standard library function
names in C90 have underscores, because I don't care that much.)

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

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

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 19:58:41 -0700
Organization: None to speak of
Lines: 35
Message-ID: <87r0nqecgu.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>
<AUaGM.174236$JG_b.91752@fx39.iad>
<874jkmfyqp.fsf@nosuchdomain.example.com>
<yhdGM.457100$xMqa.361350@fx12.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1a7ecb700a546ba1326d8f9e5790cb8d";
logging-data="450843"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185qGcOTLEZHCmxQuDWiCPv"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:NJAu7QjpIVa2CRQ7FP94YwfBQzM=
sha1:ESM7DwSoPb4/JXdbHJwhnRbZDok=
 by: Keith Thompson - Sat, 26 Aug 2023 02:58 UTC

Richard Damon <Richard@Damon-Family.org> writes:
> On 8/25/23 8:12 PM, Keith Thompson wrote:
[...]
>> Another issue is that library functions can additionally be defined
>> as macros. One solution would be to say that if you use a named
>> parameter association, it bypasses the macro and calls the function
>> -- which could break some contrived macro invocations. Another would
>> be to allow named parameter associations for macro invocations as
>> well as function calls.
>
> The problem would be needing to completely throw out the existing
> phases of translation.
>
> For instance, a translation unit is allowed to have defined something like:
>
> #define s1 x+y(
>
> before including the system headers. so to ignore that macro in that
> context, would need a complete change in how the preprocessor works.
>
> The fact that s1 is in the user namespace says the header can't
> actually have used that name.
>
> This is why actual headers are filled with names that begin with underscores

My suggestion is that if you define s1 as a macro, something like
strcpy(s1: dst, s2: src);
would simply expand the macro, and very likely fail to compile. I don't
think it's likely to be a problem in practice. No existing code uses
the new feature, so in that sense it would be backward compatible.

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

<5e0128a0-507d-48a1-9fc3-04d7479068efn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:19a4:b0:76e:e858:3511 with SMTP id bm36-20020a05620a19a400b0076ee8583511mr475604qkb.6.1693018987217;
Fri, 25 Aug 2023 20:03:07 -0700 (PDT)
X-Received: by 2002:a05:6808:2005:b0:3a3:8c81:a86f with SMTP id
q5-20020a056808200500b003a38c81a86fmr434730oiw.7.1693018986923; Fri, 25 Aug
2023 20:03:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 25 Aug 2023 20:03:06 -0700 (PDT)
In-Reply-To: <ucabgk$2691$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5f9:166e:840e:d1f9;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5f9:166e:840e:d1f9
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<610a41a0-a3a3-4e01-a9a7-8b5e1fe31ec0n@googlegroups.com> <87350dtive.fsf@bsb.me.uk>
<ubvan6$1rb3s$1@dont-email.me> <3c87ec37-8fe1-4171-9500-609fad6701b7n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me> <e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me> <b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me> <d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me> <d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me> <1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me> <81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me> <8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <ucabgk$2691$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5e0128a0-507d-48a1-9fc3-04d7479068efn@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Sat, 26 Aug 2023 03:03:07 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Malcolm McLean - Sat, 26 Aug 2023 03:03 UTC

On Friday, 25 August 2023 at 14:49:23 UTC+1, Bart wrote:
> On 25/08/2023 08:46, David Brown wrote:
> > On 24/08/2023 16:50, Malcolm McLean wrote:
>
> >> Languages that allow named parameters are nice, and if I was extending C
> >> I would introduce that. The problem is that there are a few basic
> >> mathematical
> >> functions like tan() which are conventionally written tan(value), and
> >> that was
> >> then used a model for what other functions would be like. However only
> >> a few
> >> user-written functions calculate similar basic mathematical functions.
> >> Generally it make sense to write payroll(employees=emp, Nemployees=N,
> >> taxcode=1234), not payroll(emp, N, 1234);
> >
> > There are good historical reasons for why named parameters are not
> > common in older languages, but are more common in newer ones. And there
> > are good technical reasons why they would be difficult to introduce to C
> > as an afterthought.
> Which are?

Thank you. You actually write compilers.

Re: C vs Haskell for XML parsing

<f0eGM.457102$xMqa.276001@fx12.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: C vs Haskell for XML parsing
Content-Language: en-US
Newsgroups: comp.lang.c
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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>
<AUaGM.174236$JG_b.91752@fx39.iad> <874jkmfyqp.fsf@nosuchdomain.example.com>
<yhdGM.457100$xMqa.361350@fx12.iad> <87r0nqecgu.fsf@nosuchdomain.example.com>
From: Richard@Damon-Family.org (Richard Damon)
In-Reply-To: <87r0nqecgu.fsf@nosuchdomain.example.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 41
Message-ID: <f0eGM.457102$xMqa.276001@fx12.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 25 Aug 2023 23:07:55 -0400
X-Received-Bytes: 3446
 by: Richard Damon - Sat, 26 Aug 2023 03:07 UTC

On 8/25/23 10:58 PM, Keith Thompson wrote:
> Richard Damon <Richard@Damon-Family.org> writes:
>> On 8/25/23 8:12 PM, Keith Thompson wrote:
> [...]
>>> Another issue is that library functions can additionally be defined
>>> as macros. One solution would be to say that if you use a named
>>> parameter association, it bypasses the macro and calls the function
>>> -- which could break some contrived macro invocations. Another would
>>> be to allow named parameter associations for macro invocations as
>>> well as function calls.
>>
>> The problem would be needing to completely throw out the existing
>> phases of translation.
>>
>> For instance, a translation unit is allowed to have defined something like:
>>
>> #define s1 x+y(
>>
>> before including the system headers. so to ignore that macro in that
>> context, would need a complete change in how the preprocessor works.
>>
>> The fact that s1 is in the user namespace says the header can't
>> actually have used that name.
>>
>> This is why actual headers are filled with names that begin with underscores
>
> My suggestion is that if you define s1 as a macro, something like
> strcpy(s1: dst, s2: src);
> would simply expand the macro, and very likely fail to compile. I don't
> think it's likely to be a problem in practice. No existing code uses
> the new feature, so in that sense it would be backward compatible.
>

The problem is that the standard way the system header is defined, is
that it will also use that name, and the system header won't compile,
which isn't conforming behavior.

While the implementtion doesn't need to store the system headers as
normal include files, it is a very common way to define them.

Re: C vs Haskell for XML parsing

<8acf0486-4880-4df4-8e9b-aeb6c4489316n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:7f85:0:b0:403:b888:fa29 with SMTP id z5-20020ac87f85000000b00403b888fa29mr497078qtj.0.1693019891769;
Fri, 25 Aug 2023 20:18:11 -0700 (PDT)
X-Received: by 2002:ad4:4d50:0:b0:63d:30b8:ff8a with SMTP id
m16-20020ad44d50000000b0063d30b8ff8amr468969qvm.1.1693019891579; Fri, 25 Aug
2023 20:18:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 25 Aug 2023 20:18:11 -0700 (PDT)
In-Reply-To: <ucbjph$96fa$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5f9:166e:840e:d1f9;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5f9:166e:840e:d1f9
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me> <e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me> <b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me> <d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me> <d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me> <1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me> <81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me> <8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<uca3sh$p9c$1@dont-email.me> <878r9zeynn.fsf@nosuchdomain.example.com>
<AUaGM.174236$JG_b.91752@fx39.iad> <ucbjph$96fa$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8acf0486-4880-4df4-8e9b-aeb6c4489316n@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Sat, 26 Aug 2023 03:18:11 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3022
 by: Malcolm McLean - Sat, 26 Aug 2023 03:18 UTC

On Saturday, 26 August 2023 at 02:16:48 UTC+1, Bart wrote:
>
> > I think the biggest issue there is that the names would need to be
> > somewhat ugle as they would need to be in the implementation reserved
> > namespace, as anything in the user namespace might be a macro
> So, if a function uses x and y parameters, they can clash with
> user-defined macros called 'x' and 'y'?
>
Yes. The problem is this.

/* foo.h */
void foo(int x);

#define x 100
#include "foo.h"

It's unlikely that anyone would be so stupid as to #define x, but other parameter
names, such as "Nelements", might clash with symbols someone would want to
use.
To get round this problem, some people omit parameter names from headers in
the prototype.
void foo(int)

Of course if you do this in user code then it is a complete nightmare, because
someone reading the code then. has no clue what the parameters mean.

Re: C vs Haskell for XML parsing

<353beb7c-0502-44de-8a2b-4890d6efe8cdn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:1343:b0:400:a226:316e with SMTP id w3-20020a05622a134300b00400a226316emr501535qtk.0.1693020408786;
Fri, 25 Aug 2023 20:26:48 -0700 (PDT)
X-Received: by 2002:ad4:588f:0:b0:635:dd93:a742 with SMTP id
dz15-20020ad4588f000000b00635dd93a742mr505448qvb.2.1693020408616; Fri, 25 Aug
2023 20:26:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.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: Fri, 25 Aug 2023 20:26:48 -0700 (PDT)
In-Reply-To: <87v8d2eclx.fsf@nosuchdomain.example.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5f9:166e:840e:d1f9;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5f9:166e:840e:d1f9
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<ubvo4d$1tm0p$1@dont-email.me> <e9853969-42ce-48db-81e1-d37c8e4da59dn@googlegroups.com>
<uc28id$2dc7f$1@dont-email.me> <b21393a6-c4f5-436a-9975-8ffedd6bf20bn@googlegroups.com>
<uc2dbv$2e4tg$1@dont-email.me> <d734d616-b18e-4e67-b858-f0eb0a636a87n@googlegroups.com>
<uc2qnl$2gh96$1@dont-email.me> <d651e08e-033d-4a90-8477-6a5fa13d30f3n@googlegroups.com>
<uc4e4t$2rdlt$1@dont-email.me> <1e79f8a1-b707-4074-b272-ce4327ee7bc0n@googlegroups.com>
<uc5dd0$30jrk$1@dont-email.me> <81879984-43e7-409a-a029-1ca6677f536dn@googlegroups.com>
<uc5mlk$32gl3$1@dont-email.me> <8eec8404-4928-4bc3-8b00-c673ea22ab60n@googlegroups.com>
<uc7l4o$3fp72$1@dont-email.me> <639e8e6f-2729-476b-9a6e-0b3eb066b06an@googlegroups.com>
<uc9m7v$3u797$1@dont-email.me> <d3c6df71-7ef5-4fd3-83be-8b9a4315f0c4n@googlegroups.com>
<87h6onfje9.fsf@nosuchdomain.example.com> <a196bf8d-9613-4ff3-ac60-6c8e192b8c7an@googlegroups.com>
<87v8d2eclx.fsf@nosuchdomain.example.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <353beb7c-0502-44de-8a2b-4890d6efe8cdn@googlegroups.com>
Subject: Re: C vs Haskell for XML parsing
From: malcolm.arthur.mclean@gmail.com (Malcolm McLean)
Injection-Date: Sat, 26 Aug 2023 03:26:48 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: Malcolm McLean - Sat, 26 Aug 2023 03:26 UTC

On Saturday, 26 August 2023 at 03:55:53 UTC+1, Keith Thompson wrote:
> Malcolm McLean <malcolm.ar...@gmail.com> writes:
>
> > However that's not the explanation for isdigit() rather than is_digit().
> I should have said 6 *significant* characters, so is_digit and
> is_digest might be treated as the same identifier. The early limits
> on external identifiers forced terse names for library functions.
> Adding underscores for only some function names would not have been
> helpful. (I haven't checked whether any standard library function
> names in C90 have underscores, because I don't care that much.)
>
What I said to David Brown was that standard library functions were the
most commonly called functions in C code, and were all written in the
style I am recommending. He responded by pointing out that some
rarely used non-function identiifers, not I think in Ritchie's original
version of C, have underscores. So only half understanding the point.

Underscores have been introduced for a handful of new time and date
fucntions which have "restart" options, indicated y a "_r" suffix.

Terseness due to the limitations of compilers and linkers at the time
is part of the explanation, of course. But it could easily have been
is_digit() rather than "isdigit", and my point stands.

Re: C vs Haskell for XML parsing

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

  copy mid

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

  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.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: C vs Haskell for XML parsing
Date: Fri, 25 Aug 2023 21:17:20 -0700
Organization: None to speak of
Lines: 51
Message-ID: <87il92e8tr.fsf@nosuchdomain.example.com>
References: <576801fa-2842-40dc-bf19-221a5b1cf660n@googlegroups.com>
<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>
<AUaGM.174236$JG_b.91752@fx39.iad>
<874jkmfyqp.fsf@nosuchdomain.example.com>
<yhdGM.457100$xMqa.361350@fx12.iad>
<87r0nqecgu.fsf@nosuchdomain.example.com>
<f0eGM.457102$xMqa.276001@fx12.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1a7ecb700a546ba1326d8f9e5790cb8d";
logging-data="474336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uU6oOmLpwDK/WXUlBvQ63"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:XMktMp92VM5ruFy72CD2EUrPF6Y=
sha1:6QKN90SsY+CWv9kFtsKqQFSqqjo=
 by: Keith Thompson - Sat, 26 Aug 2023 04:17 UTC

Richard Damon <Richard@Damon-Family.org> writes:
> On 8/25/23 10:58 PM, Keith Thompson wrote:
>> Richard Damon <Richard@Damon-Family.org> writes:
>>> On 8/25/23 8:12 PM, Keith Thompson wrote:
>> [...]
>>>> Another issue is that library functions can additionally be defined
>>>> as macros. One solution would be to say that if you use a named
>>>> parameter association, it bypasses the macro and calls the function
>>>> -- which could break some contrived macro invocations. Another would
>>>> be to allow named parameter associations for macro invocations as
>>>> well as function calls.
>>>
>>> The problem would be needing to completely throw out the existing
>>> phases of translation.
>>>
>>> For instance, a translation unit is allowed to have defined something like:
>>>
>>> #define s1 x+y(
>>>
>>> before including the system headers. so to ignore that macro in that
>>> context, would need a complete change in how the preprocessor works.
>>>
>>> The fact that s1 is in the user namespace says the header can't
>>> actually have used that name.
>>>
>>> This is why actual headers are filled with names that begin with underscores
>> My suggestion is that if you define s1 as a macro, something like
>> strcpy(s1: dst, s2: src);
>> would simply expand the macro, and very likely fail to compile. I don't
>> think it's likely to be a problem in practice. No existing code uses
>> the new feature, so in that sense it would be backward compatible.
>>
>
> The problem is that the standard way the system header is defined, is
> that it will also use that name, and the system header won't compile,
> which isn't conforming behavior.
>
> While the implementtion doesn't need to store the system headers as
> normal include files, it is a very common way to define them.

Hmm. The standard could say that if you define a parameter name as an
object-like macro before including a header that declares a function
with that parameter, the behavior is undefined. In other words,
standard parameter names would be reserved, but in fewer contexts than
standard function names. Since parameter names are lowercase, there
shouldn't be a lot of code using them as macros.

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