Deutsch   English   Français   Italiano  
<20250414155907.846@kylheku.com>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: do { quit; } else { }
Date: Mon, 14 Apr 2025 23:12:20 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 93
Message-ID: <20250414155907.846@kylheku.com>
References: <vspbjh$8dvd$1@dont-email.me> <vt31m5$2513i$1@dont-email.me>
 <vt3d4g$2djqe$1@dont-email.me> <vt3iqh$2ka99$1@dont-email.me>
 <vt5fed$ccri$1@dont-email.me> <vt5js2$g1t7$1@dont-email.me>
 <20250409142303.00004645@yahoo.com>
 <87ikndqabc.fsf@nosuchdomain.example.com>
 <20250410115501.000037a5@yahoo.com> <vt8ei8$2vn84$1@dont-email.me>
 <20250410080629.532@kylheku.com> <vt94q5$3jjod$1@dont-email.me>
 <vt9628$3hhr8$3@dont-email.me> <vtammh$174ev$1@dont-email.me>
 <vtavn9$1dp7m$3@dont-email.me> <vtb8nv$1plb2$2@dont-email.me>
 <vtba81$1qfbm$1@dont-email.me> <vtbc6o$1te2o$1@dont-email.me>
 <vtbhjv$24api$1@dont-email.me> <vtbn2k$293r1$1@dont-email.me>
 <vtc19j$2kqlj$1@dont-email.me> <87a58mqt2o.fsf@nosuchdomain.example.com>
 <vtc7mp$2q5hr$1@dont-email.me> <vtcqf6$3j95s$1@dont-email.me>
 <vtdh4q$b3kt$1@dont-email.me> <vtf7fe$1qtpg$1@dont-email.me>
 <vtgfuf$31ug1$1@dont-email.me> <20250413072027.219@kylheku.com>
 <vtgpce$39229$1@dont-email.me>
Injection-Date: Tue, 15 Apr 2025 01:12:23 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="16520bcd085ba48f48bf86c676aa114c";
	logging-data="2460642"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18mb+5uyizI14+2uViT7vhhC2QcLAk7eSM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:Ni+Ir3cCqTlMkdVGgkzmlPRWPKc=
Bytes: 5196

On 2025-04-13, bart <bc@freeuk.com> wrote:
> On 13/04/2025 15:34, Kaz Kylheku wrote:
>> On 2025-04-13, bart <bc@freeuk.com> wrote:
>>> On 13/04/2025 03:27, Janis Papanagnou wrote:
>>>> On 12.04.2025 13:00, bart wrote:
>>>
>>>>> But I also 100% hate its syntax and various other bits and pieces. (OK,
>>>>> about 80% then.)
>>>>
>>>> (I also don't like its syntax too much. I think I'm just complaining
>>>> less than you about that. BTW, I've got the impression that all the
>>>> shortcomings of "C" are well known by most regulars here; they just
>>>> handle these facts in discussions differently than you.)
>>>
>>> The shortcomings are downplayed considerably. Especially in discussions
>>> involving me because they don't like it whenever someone states the obvious.
>>>
>>> But also, most here have to use it professionally, so have learned to
>>> work around it.
>> 
>> There are lots of examples of people just liking C.
>
> C itself, or the things that C allowed you to do?

Me, I like C. I use C in side projects. I will code in C no matter what
I use at work.

C is the only acceptable non-Lisp.

> Well, given Knuth's own language was MIX (assembly for a made-up 
> machine), it is not surprising he prefers C.

He wrote TeX in Pascal though. The Web system includes a Pascal to C
translator. (I don't know the details.)

>> C has spawned imitation in the form of "C like" languages, that all
>> started as grenfield projects that could have chosen any syntax
>> they wanted.
>
> Some of this is to be expected: if they started off using brace syntax, 
> then their language will use braces. But some of the things they copy 
> are odd, like this for-loop from JS:
>
>    for(let i = 1; i <= 36; i++) {

The first time I encountered a C for loop used for non-numbers
was a watershed moment for me. I rubbed my eyes once or twice.

"Wow, wait, you can do that?"

It might have been in the source code of an IRC client I was
compiling, where it had something like this:

   for (node = list; node; node = node->next)

I realized, OMG, this is a great way of defining a for loop
construct. This is why for is the way it is.

So much better than the crap languages I used before which restricted a
dummy variable into going from one number to another.

That might have been the point after which I didn't look back.

Later I learned that much of the cool stuff around control flow
and expressions in C actually came from Lisp.

- Ternary if:  (if test then else).

- Expressions having values, even assignments:  (setq a (setq b (setq c 0))) 

- Loops working with arbitrary data types.

> Is it that hard to provide a proper for-loop where you don't have to 
> spell out every single detail? Fortran managed it in the 1950s!

No, it isn't, especially if you don't need once-only evaluation of the
range points:

#define for_range (type, var, from, to) \
   for (type var = from; var <= to; var++)

Anyway, languages should be programmable so you're not stuck with
the loop that is built into the parser.

If I were to pick a non-C language for systems programming today, I
would take a serious look at Thomas Mertes' Seed 7, probably.

It lets you define new statement and such.

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