Deutsch   English   Français   Italiano  
<3b3facef6fdb6ad4edb2989a0a18fd2f2526c536@i2pn2.org>

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

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.quux.org!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: fir <fir@grunge.pl>
Newsgroups: comp.lang.c
Subject: Re: else ladders practice
Date: Sun, 03 Nov 2024 15:17:46 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <3b3facef6fdb6ad4edb2989a0a18fd2f2526c536@i2pn2.org>
References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org> <vg0t3j$2ruor$1@dont-email.me> <78eabb4054783e30968ae5ffafd6b4ff2e5a5f17@i2pn2.org> <vg2g37$37mh3$1@dont-email.me> <6724CFD2.4030607@grunge.pl> <vg2llt$38ons$1@dont-email.me> <2491a699388b5891a49ef960e1ad8bb689fdc2ed@i2pn2.org> <b681ee05856e165c26a5c29bf42a8d9d53843d6d@i2pn2.org> <vg2ttn$3a4lk$1@dont-email.me> <vg33gs$3b8n5$1@dont-email.me> <vg358c$3bk7t$1@dont-email.me> <vg37nr$3bo0c$1@dont-email.me> <vg3b98$3cc8q$1@dont-email.me> <vg5351$3pada$1@dont-email.me> <vg62vg$3uv02$1@dont-email.me> <6726C341.6030102@grunge.pl> <vg7opm$bejq$2@dont-email.me> <bf4e50819b1dcac5e7f689ad10b3a82e8fc82047@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 3 Nov 2024 14:17:50 -0000 (UTC)
Injection-Info: i2pn2.org;
	logging-data="759344"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <bf4e50819b1dcac5e7f689ad10b3a82e8fc82047@i2pn2.org>
Bytes: 4394
Lines: 119

fir wrote:
> Bart wrote:
>> On 03/11/2024 00:26, fir wrote:
>>> Bart wrote:
>>>>  ...
>>>
>>> as to this switch as i said the C jas some syntax that resembles
>>> switch and it is
>>>
>>> [2] { printf("one"), printf("two"), printf("three") }
>>>
>>> i mean it is like this compound sometheng you posted
>>>
>>>   { printf("one"), printf("two"), printf("three") } [2]
>>>
>>>   but with "key" on the left to ilustrate the analogy to
>>>
>>> swich(n) {case 0: printf("one"); case 1: printf("two"); case 2:
>>> rintf("three") }
>>>
>>> imo the resemblance gives to think
>>>
>>> the difference is this compound (array-like) example dont uses defined
>>> keys so it semms some should be added
>>>
>>> [n] {{1: printf("one")},{2: printf("two")},{3: printf("three")} }
>>>
>>> so those deduction on switch gives the above imo
>>>
>>> the question is if some things couldnt be ommitted for simplicity
>>>
>>> [key] {'A': printf("one"); 'B': printf("two"); 'C': printf("three"}; }
>>
>>
>>> something like that
>>>
>>> (insted of
>>>
>>> switch(key)
>>> {
>>> case 'A': printf("one"); break;
>>> case 'B': printf("two"); break;
>>> case 'C': printf("three"}; break;
>>> }
>>
>>
>> Here the switch looks clearer. Write it with 300 cases instead of 3,
>> then that becomes obvious.
>>
>
> depend on what some understoods by clearer - imo not
>
> this []{;;;} at least is like logically drawed from other c syntax
>
> and switch case overally the word case is ok imo but the word switch is
> overrally like wrong imo switch could be better replaced by two
> word "select" and maybe "goto" as this swich that selects could use
> select and this one wgo does goto could use word goto
>
> goto key;
> 'A': printf("a");
> 'B': printf("b");
> 'C': printf("c");
> '
>
> overally thete is lso possibility to do it such way
>
> void foo()
> {
>
> "a" { printf("aaa"); } //definitions not calls itself
> "b" { printf("bbb"); }
> "c" { printf("ccc"); }
>
>
> "a";"b";"c"; //calls (???)
> // would need maybe some some syntax to call it (many could be chosen)
>
> // "a"() ? foo."a" ? foo.[key] ?
>
> maybe this woudl be the best if established as ths is more syntaktc "low
> lewel"
>
> }
>

the calling sign shuld be needed as as for years i wanted to do 
something like

void foo()
{
a {/**/}
b {/**/}
c {/**/}

  a;b;b;c; //calls a calls b twice calls c

}

( you  can alse make expressions of it a+b*c (where a,b,c are code blocks)

then if using

1 {/**/}
2 {/**/}
3 {/**/}

"A" {/**/}
"B" {/**/}
"CCC" {/**/}

it would clash with normal usage
lika printf("CCC");

so some operator to call it is needed (and it could wrk as swich if you 
allow to call it on variable not immediate value