Deutsch   English   Français   Italiano  
<vgljq9$39pv5$2@dont-email.me>

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

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: else ladders practice
Date: Fri, 8 Nov 2024 18:03:54 +0000
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <vgljq9$39pv5$2@dont-email.me>
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> <vg8a84$euka$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 08 Nov 2024 19:03:53 +0100 (CET)
Injection-Info: dont-email.me; posting-host="33e6c63f87222477390301c1377b09f9";
	logging-data="3467237"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19vx4hGBd8whOKKf/iNBSTM"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ow5cAdJ3Znzjsph2o2iKqr04g1Q=
Content-Language: en-GB
In-Reply-To: <vg8a84$euka$1@dont-email.me>
Bytes: 3055

On 03/11/2024 17:00, David Brown wrote:
> On 02/11/2024 21:44, Bart wrote:

>> (Note that the '|' is my example is not 'or'; it means 'then':
>>
>>     (  c |    a )          # these are exactly equivalent
>>     if c then a fi
>>
>>     (  c |    a |    b )     # so are these [fixed]
>>     if c then a else b fi
>>
>> There is no restriction on what a and b are, statements or 
>> expressions, unless the whole returns some value.)
> 
> Ah, so your language has a disastrous choice of syntax here so that 
> sometimes "a | b" means "or", and sometimes it means "then" or 
> "implies", and sometimes it means "else". 

I missed this part of a very long post until JP commented on it.

As I mentioned above, "|" here doesn't mean 'or' at all. In "( ... | ... 
| ... )", the first means "then" and the second "else". (It also wasn't 
my idea, it was taken from Algol 68.)


> Why have a second syntax with 
> a confusing choice of operators when you have a perfectly good "if / 
> then / else" syntax?

if/then/else suits multi-line statements. (||) suits terms that are part 
of a larger one-line expression.

I might as well ask why C uses ?: when it has if-else, or why it needs 
P->m when it has (*P).m.




> Or if you feel an operator adds a lot to the 
> language here, why not choose one that would make sense to people, such 
> as "=>" - the common mathematical symbol for "implies".

It is not an operator, it is part of '(x | x,x,x | x)' syntax.