Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: bart Newsgroups: comp.lang.c Subject: Re: Interval Comparisons Date: Thu, 6 Jun 2024 19:48:42 +0100 Organization: A noiseless patient Spider Lines: 63 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 06 Jun 2024 20:48:43 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b02ee27fe84d0707205a15f2e6befadb"; logging-data="1712532"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rF//1hXsYO8HEZeJ6njp8" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:JQy0EtIQOuMHglkMKHjzKOWDTKo= In-Reply-To: Content-Language: en-GB Bytes: 2926 On 05/06/2024 02:30, Lawrence D'Oliveiro wrote: > On Wed, 5 Jun 2024 00:22:36 +0100, bart wrote: > >> On 05/06/2024 00:12, Lawrence D'Oliveiro wrote: >> >>> On Tue, 4 Jun 2024 11:41:54 -0000 (UTC), Blue-Maned_Hawk wrote: >>> >>>> i think that we need not worsen the matter with new ternary operators. >>> >>> These are not ternary operators. >> >> So what are they? > > A special case in the syntax rules for the comparison operators > . > >> I've implemented them several times, and found they really need to be >> treated as a special kind of n-ary opterator. > > Remember, Python allows users to define custom overloads for the standard > operators. For comparisons, these functions always take two operands, and > the compiler takes care of invoking them correctly to handle interval > comparisons. Well, for these 3 lines in my scripting language: if a = b then end # universal if a = b < c then end # chained (like Python, unlike C) if (a = b) < c then end # emulate C behaviour These are the ASTs produced (2: is the empty True branch; 3: would be for the 'else' branch, not present here): - 1 if: - - 1 eq: - - - 1 name: a - - - 2 name: b - - 2 block: - 1 if: - - 1 cmpchain: eq lt - - - 1 name: a - - - 1 name: b - - - 1 name: c - - 2 block: - 1 if: - - 1 lt: - - - 1 eq: - - - - 1 name: a - - - - 2 name: b - - - 2 name: c - - 2 block: Notice the middle one is one linear group with N operands and N-1 comparisons. No operator overloads are allowed, but if they were, it would still work, but a comparison operator would be required to return True or False from its two operands. It would be unwise for it to return a string for example.