🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1409

Re: p = {1,0,0}

#1409
From: bartc
Date: Tue, 10 Nov 2026 12:08
80 lines
4902 bytes
On 10/11/2026 08:24, David Brown wrote:
> On 10/11/2026 02:11, bartc wrote:

>> Have you looked at /any/ other at languages at all? Take some ideas 
>> from those.
> 
> Or look at C.  It is not exactly a challenge to have :
> 
> #define For(_var, _limit) for (int _var = 0; _var < _limit; _var++)
> 
> and then you can write :
> 
>      For(i, 100)
> 
> With a little more effort, you can even make a single macro that could 
> handle :
> 
>      For(100)    // Automatic anonymous variable
> 
> and
> 
>      For(i, 1, 100)    // If you don't want to start at 0

This is stuff I used to do. Then I realised then using a private macro 
library to refine the language doesn't work (when posting code on forums 
for example).

>> Try the idea from above (upper limit is exclusive):
>>
>>    for i=0,strlen(a) {a[i]==0 ? break}
>>
>> (I won't comment on that ? construct.)
>>
> 
> The big trouble with playing syntax games like Fir is doing (and you are 
> doing, to a lesser extent) is that it is very easy to write code 
> snippets as examples, but very difficult to make a complete set of 
> syntax and grammar rules that are not ambiguous or in conflict with each 
> other.  Fir does not need to consider that at all in his ramblings - he 
> just lets his cat wander across his keyboard.  For a real language for 
> widespread use,

The examples I gave here were just starting points: saner ideas 
(compared to /needing/ Unicode for identifiers for example). But they 
are based on real features used elsewhere.

They are vaguely C-like, but whatever fir is planning is a long way from 
C anyway. He's not interested in workarounds using actual C.

> it is far more difficult as you have to consider all 
> conceivable corner cases or strange usage.  (For your languages, Bart, 
> you have a middle ground - since you are the only user, you can easily 
> ensure that all users stay away from awkward corner cases.

A language only needs to be real, not widespread, for the syntax choices 
to be valid. There is nothing wrong or ambiguous about the grammar used 
for my loop constructs.

This kind of feature is one of the simplest to get right in a language, 
especially when it is 1-based.

0-based languages make ranges a little more ambiguous. (I believe Zig 
held back on having an iterative for-statement because of this, since 
the upper bounds usually needs to be exclusive.)

Or do you mean that what I have is not as flexible as a C-style 
for-loop? That would be true. The nearest thing I have to:

    for (A; B; C) {

is:

     A
     while B, C do

(This had been a suggested replacement for C's for-loop, which I 
implemented as a proof-of-concept. I decided to keep the feature and use 
it for linked-list traversal, the primary use-case when people explain 
why C for-loops are better.)
Technical Details
Message-ID: <11cv1ft$24amr$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me> <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me> <11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me> <11ccnkq$3pjhd$1@dont-email.me> <11ccobd$3ps4l$1@dont-email.me> <11cctee$3rtjh$1@dont-email.me> <11ccu0t$3s54f$1@dont-email.me> <11ccv4n$3sjn5$1@dont-email.me> <11cd05l$3t1er$1@dont-email.me> <11cd0q3$3ta28$1@dont-email.me> <11cd1vs$3tpfp$1@dont-email.me> <11cnve1$3ofei$1@dont-email.me> <11co8d4$3rpvm$1@dont-email.me> <14be9ea5-918f-5871-1bba-11e29e6e25d5@gmail.com> <11coqot$1236$1@dont-email.me> <11cplsf$8nc4$1@dont-email.me> <11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me> <11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me> <11ctijh$1mb1u$1@dont-email.me> <11ctr0o$1or07$1@dont-email.me> <11cukc4$1vnj7$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: bartc <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: p = {1,0,0}
Date: Tue, 10 Nov 2026 12:08:28 +0000
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <11cv1ft$24amr$1@dont-email.me>
References: <11c7f1j$20b9h$1@dont-email.me> <11c7fj6$20gab$1@dont-email.me>
 <11cae5m$318tq$1@dont-email.me> <11calrt$34gq3$1@dont-email.me>
 <11carqs$36m0o$1@dont-email.me> <11cb4hs$3a13l$1@dont-email.me>
 <11ccnkq$3pjhd$1@dont-email.me> <11ccobd$3ps4l$1@dont-email.me>
 <11cctee$3rtjh$1@dont-email.me> <11ccu0t$3s54f$1@dont-email.me>
 <11ccv4n$3sjn5$1@dont-email.me> <11cd05l$3t1er$1@dont-email.me>
 <11cd0q3$3ta28$1@dont-email.me> <11cd1vs$3tpfp$1@dont-email.me>
 <11cnve1$3ofei$1@dont-email.me> <11co8d4$3rpvm$1@dont-email.me>
 <14be9ea5-918f-5871-1bba-11e29e6e25d5@gmail.com>
 <11coqot$1236$1@dont-email.me> <11cplsf$8nc4$1@dont-email.me>
 <11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me>
 <11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me>
 <11ctijh$1mb1u$1@dont-email.me> <11ctr0o$1or07$1@dont-email.me>
 <11cukc4$1vnj7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 10 Nov 2026 12:08:29 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2239195"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+ry61WZJcjbaGVDl9rK+6T"; posting-host="4695183c8b99665fc19e8d6c8d0d67a8"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:4LcgFSlbHf6C5Zi+hkBrdxp8474= sha256:p59d+nIIlyG9VJJlKiJJnpgM6hp7g97IPJjQ7nU6FoM=
	sha1:D+fRvJdsrPK46P4dsgknNAozdz4= sha256:QI5WLrzKVrPaYZb8lfKncE/LyiDvadXDJLyQI4edAYw=
In-Reply-To: <11cukc4$1vnj7$1@dont-email.me>
Content-Language: en-GB