Re: Short circuit warning error

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu