Re: Short circuit warning error
- Posted by Robert Craig <rds at RapidEuphoria.com> Apr 26, 2005
- 432 views
Pete Lomax wrote: > The line > > if id=Main or getFocus()=0 or id!=getParentWindow(getFocus()) then > > issues a warning message that getFocus() might be short circuited, but > > if getFocus()=0 or id=Main or id!=getParentWindow(getFocus()) then > > does not. Personally, I'd like to see short circuit warning messages > removed completely, but failing that at least make them correct. In your second line, with left-to-right evaluation, getFocus() will always be called, so there is no need for a short-circuit warning, at least for the first instance of getFocus(). However getFocus() is called again near the end of the line, and Euphoria should warn about that call. It looks like Euphoria is not smart enough to warn about short-circuited nested calls. I'll take a look at it. This warning was introduced a long time ago, when short-circuit evaluation was added. The main idea was to catch places in old code where short-circuiting could cause the code to "break". Not many cases of actual breakage were ever found, but I think the warning is still useful. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com