1. Short-circuiting
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Jun 22, 1998
- 566 views
Well, turn on and off. Doesn't sound flexible enough. I want to be able to see in my code wich code is short-circuited and wich ins't. Wouldn't that be nice ? He ? That's Euphoria already: In Euphoria you *can* short-circuit. Any fool could see how it works, it isn't with the use of complicated symbols. And you can precisizely say which parts are short-circuited and which aren't: Seeeee ??? -- This is short-circuited 3 -times if 1 then if 1 then if 1 then puts (1,"I'm in a short circuited if-statement, aint that nice ?\n") end if end if end if So it's back to the usual, "we have to type so much" discussion that comes back every 3 months, previously more about the use of length () and an 'end' operator. Direct slicing, etc. But this too, is just another 'we have to type so much discussion' Ralf
2. Re: Short-circuiting
- Posted by Robert B Pilkington <bpilkington at JUNO.COM> Jun 22, 1998
- 560 views
On Mon, 22 Jun 1998 08:34:21 +0200 Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> writes: >Well, turn on and off. >Doesn't sound flexible enough. >I want to be able to see in my code wich code is short-circuited and >wich ins't. >Wouldn't that be nice ? > >He ? That's Euphoria already: >In Euphoria you *can* short-circuit. Any fool could see how it works, >it isn't with the use of complicated symbols. And you can precisizely say >which parts are short-circuited and which aren't: > >Seeeee ??? > >-- This is short-circuited 3 -times >if 1 then if 1 then if 1 then > puts (1,"I'm in a short circuited if-statement, aint that nice ?\n") >end if end if end if Yup, looks pretty good to me, except all the "end if"s can get a little hard to keep track of: if length(enemy)=0 then if length(rocks)=0 then if length(sats)=0 then if length(shots)=0 then if length(particles)=0 then if length(powerups)=0 then Next_Level() end if end if end if end if end if end if Greg Harris did short-circuting in this manner with Vector, and the speed increase was only a couple frames per second after my first (and only, so far) test. That was with other (better) optimizations, also. Doesn't seem to me like too big a deal, if there is some code that would *REALLY* benefit from it, then just do it in the above manner, but make it look nicer... And short-circut the code that really needs it, not the rest that wouldn't benefit much at all from it. >So it's back to the usual, "we have to type so much" discussion that >comes back every 3 months, previously more about the use of length () and an >'end' operator. Direct slicing, etc. But this too, is just another 'we have >to type so much discussion' Hey, I type at 80 words per minute..... I'm not worried about extra typing.. :) (Well, that's my adjusted words per minute.. after errors... I make quite a few..) Besides, if you're using variable names that are too long, then you should shorten them. Even if you just assign it to "object junk" before you do some ifs so you don't have to type it 3 times, fine... :) _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]