1. Short circuit warning error
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Apr 26, 2005
- 455 views
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. Regards, Pete
2. Re: Short circuit warning error
- Posted by Robert Craig <rds at RapidEuphoria.com> Apr 26, 2005
- 434 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
3. Re: Short circuit warning error
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Apr 26, 2005
- 444 views
On Mon, 25 Apr 2005 18:03:27 -0700, Robert Craig <guest at RapidEuphoria.com> wrote: >It looks like Euphoria is not smart enough to >warn about short-circuited nested calls. I'll take a look at it. Shit. You didn't take the bait. ) > >This warning was introduced a long time ago, >Not many cases of actual breakage were ever found Exactly. Just take it out. It is a waste of time, and damn annoying to boot. You've explained it properly in the docs, let it go. Does anyone want this warning to remain? I could argue that: if i>=0 and a[i] then should therefore generate: warning: negative and zero values of i will not crash. It would be just as useful. Regards, Pete
4. Re: Short circuit warning error
- Posted by Brian Broker <brian_broker at yahoo.com> Apr 26, 2005
- 443 views
Pete Lomax wrote: > > On Mon, 25 Apr 2005 18:03:27 -0700, Robert Craig > <guest at RapidEuphoria.com> wrote: > > >It looks like Euphoria is not smart enough to > >warn about short-circuited nested calls. I'll take a look at it. > Shit. You didn't take the bait. ) > > > >This warning was introduced a long time ago, > >Not many cases of actual breakage were ever found > Exactly. Just take it out. It is a waste of time, and damn annoying to > boot. You've explained it properly in the docs, let it go. > > Does anyone want this warning to remain? > > I could argue that: > > if i>=0 and a[i] then > > should therefore generate: > > warning: negative and zero values of i will not crash. > > It would be just as useful. > > Regards, > Pete Subscripting a value of zero will always generate a warning in your example. And I do not see how your message would be just as useful. The short circuiting message is more useful because it's easy to forget about the rule, making it tougher to debug when you are expecting a side effect. Maybe different levels of 'without warning' would be better... maybe even have a level that allows parameters (e.g. for event handlers) to be unused. -- Brian
5. Re: Short circuit warning error
- Posted by Bernie Ryan <xotron at bluefrog.com> Apr 26, 2005
- 424 views
>This warning was introduced a long time ago, >Not many cases of actual breakage were ever found >Exactly. Just take it out. It is a waste of time, and damn annoying to >boot. You've explained it properly in the docs, let it go. I agree take it out it is a pain !!! and is not worth it's annoyance !! Bernie My files in archive: w32engin.ew mixedlib.e eu_engin.e win32eru.ew Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan