From: janis_papanagnou+ng@hotmail.com   
      
   On 11/27/25 18:59, bart wrote:   
   > On 27/11/2025 17:38, Ike Naar wrote:   
   >> On 2025-11-27, bart wrote:   
   >>> Well, let's stick with C. Here are some features I use, and the C   
   >>> equivalents (A has whatever type is needed):   
   >>>   
   >>> M C   
   >>> -------------------------------------------------------------   
   >>> [snip]   
   >>> A.odd A & 1, or A % 1   
   >>   
   >> "A % 1" ?   
   >   
   > I guess A % 2 then.   
      
   You guess? - LOL - okay. :-)   
      
   > Note my remark about error proneness later on.   
      
   Higher level abstractions (usually found in higher level languages)   
   are always less error prone than low-level (or composed) constructs.   
      
   "C" is inherently and by design a comparably low-level language, so   
   I wonder what you complain here about. (You won't change that.)   
      
   'even' and 'odd' are higher level abstractions than bit-operations,   
   and they are also _special cases_ (nonetheless useful; I like them,   
   and I appreciate if they are present in any language). The general   
   case of the terms like "odd" and "even" is defined mathematically,   
   though; so the natural way of describing them would (IMO) rather be   
   based on 'x mod 2 = 1' and 'x mod 2 = 0' respectively. (So the "C"   
   syntax with '%' is probably more "appropriate". Mileages may vary.)   
      
   You can of course add as many commodity features to "your language"   
   as you like. I seem to recall that one of the design principles of   
   "C" was to not add too many keywords. (Not sure whether 'A.odd' is   
   a function or keyword above [in "your language"].) Omitting to add   
   special case operators or functions for things that can simply be   
   expressed by the respective arithmetic or boolean counterparts is   
   not an unreasonable language-detail design decision.[*]   
      
   You made a mistake above (or just a typo), never mind. I suppose it   
   stems from your primary "thinking in bits". - This is not meant to   
   be offensive. - Back in university days (I still remember!) I made   
   a similar typo but vice versa; I wanted to express "div 2" in some   
   assembler language and accidentally wrote "shift-right 2", the same   
   type of typo but the other way round. I *knew*, and didn't "guess",   
   though, that "shift-right 1" would have been correct. ;-)   
      
   Janis   
      
   [*] Compare to Algol 68 that introduced everything ("including the   
   kitchen sink"), and even in multiple variants! - A design decision   
   that is also not appreciated by everyone.   
      
   PS: BTW, I was always wondering why Pascal and Algol 68 supported   
   'odd' but not 'even'! - In the documents of the Genie compiler we   
   can read: "This is a relic of times long past.", but beyond that   
   it doesn't explain why it's a "relic". I can only guess that it's,   
   as a special case, considered just unnecessary in the presence of   
   the modulus operator.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|