1. Re: Short Circuiting

As was discussed a while back I planned to add short circuiting to my euphoria
optimiser (which should hopefully get written this summer). This will however
be for optimisation purposes rather than safe coding.

In brief, it puts all functions which might *need* to be called in the first
if statement and then nests everything else in the order it was supplied

eg

if a=1 and foo() and length(s)>0 and bar() and z<-6 then

becomes

if foo() and bar() then
  if a=1 then
    if length(s)>0 then --length() is built-in so optimiser knows it has no
effect on the world
      if z<-6 then
      end if
    end if
  end if
end if

If you wish to do short-circuiting for error-avoiding purposes I (again) agree
with Ralf :

use

if then if then if then
end if end if end if

Daniel

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu