home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,011 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to All   
   Re: extending MySQL on VMS   
   18 Aug 25 16:14:52   
   
   From: arne@vajhoej.dk   
      
   On 8/18/2025 3:42 PM, Arne Vajhøj wrote:   
   > On 8/18/2025 8:37 AM, Simon Clubley wrote:   
   >> It is _always_ safe to write code which assumes short circuiting is   
   >> not in use and it will work exactly the same even in the presence   
   >> of a compiler which generates short circuiting code.   
   >   
   > Not true.   
   >   
   > Not if the second expression has side effects.   
   >   
   > I am sure that you don't want expressions with side effect. But   
   > it happens.   
      
   Function calls is a classic example of potential side   
   effect, but many languages allow assignments in expressions.   
      
   Python 3.8 introduced the walrus operator.   
      
   $ type se1.py   
   def f():   
        print('f called')   
        return False   
      
   print('first')   
   if False and f():   
        print('problem')   
   print('second')   
   if False & f():   
        print('problem')   
   $ python se1.py   
   first   
   second   
   f called   
   $ type se2.py   
   v = 0   
   print(v)   
   print('first')   
   if False and (v := v + 1) > 100:   
        print('problem')   
   print(v)   
   print('second')   
   if False & (v := v + 1) > 100:   
        print('problem')   
   print(v)   
   $ python se2.py   
   0   
   first   
   0   
   second   
   1   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca