IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New You ever have nested while and for loops?
With a decision or 2 inside it?

Single point of exit either requires numerous flag variables that have nothing to do with the program logic - they are there as an artifact of the language itself. Additional tests at each loop level to determine whether you broke out of the loop via a decision in the loop or a loop fall out.

Or, shudder - goto - that bounces you to the bottom.

Or, my favorite solution, named loops and a "last NAME;" statement, which allows a clean breaking out of nested loops.

Whether or not you have a problem with this is not the issue. I've seen a far better way and now know better. Far less code, much cleaner and easier to code and maintain.
New "Numereous flags"
mah-noor. Except in some very unusual circumstances, the exit can be controlled by exactly 1 flag. And by namingthe flag correctly (e.g. something like failure or done ) it might even self-document.

The answer to your question is yes. Now I got one for you: Ever debugged/refactored a 16-greenbar-page function cock-full of trapdoor exits, and where you get to page 14 or so and have absolutely no idea what the conditions are that have gotten you to this place in the code, because the berk who wrote it was overly enamored with taking his/her ball and bat and going home at the slightest provocation?

Didn't think so...
jb4
"It's hard for me, you know, living in this beautiful White House, to give you a firsthand assessment."
George W. Bush, when asked if he believed Iraq was in a state of civil war (Newsweek, 26 Feb 07)
New Didn't think so?
Hah.

Wimp.

[link|http://z.iwethey.org/forums/render/content/show?contentid=266834|http://z.iwethey.org...?contentid=266834]

Just because some idiot uses certain features unwisely does not mean the language should be designed for the idiot.

Because if you really want to split hairs on this one, I've got some stories of longjmp usage.

Or in MS-DOS days, poking a few values in a certain register and jumping to zero. hhhheeeeeeheheheheehe. Warm boot from my program as a last ditch effort.

Sometimes when you setup public workstations that's all you can do.
New That's a good way out.
Although it sometimes feels a little clunky. However, sometimes that's all the language has available.

I like Icon's approach. It's a bit tricky to describe but the idea is that you can pass breaks up several layers all at once. And you can make the last one do a next, instead. It's really elegant. However, due to other qualities of the language, it doesn't get used all that much. This is because things like goal-directed evaluation and expression back-tracking and generators are usally used to implement the kind of logic and loops that people need to put in trap-door exits for. :-/

Wade.


Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please



-- "Anything but Ordinary" by Avril Lavigne.

· my ·
· [link|http://staticsan.livejournal.com/|blog] ·
· [link|http://yceran.org/|website] ·

     Seriously, Bryce, I'm not saying this to be mean, but... - (CRConrad) - (34)
         You mean the "payroll" example? Not very specific - (tablizer) - (31)
             What are you on about? No, absolutely not "Payroll example"! - (CRConrad) - (1)
                 Okay, I see it now - (tablizer)
             Wow, deja vu (hypothetically) - (drewk) - (28)
                 Which one? - (tablizer) - (27)
                     Neither - (drewk) - (26)
                         Thank you, that was very helpful - (tablizer) - (25)
                             No, thank *you* - (drewk)
                             Burden Of Proof - (pwhysall) - (23)
                                 thats easy c++ :-) -NT - (boxley) - (19)
                                     idontnowatumeenbox.c++isorlrite - (pwhysall)
                                     C is a crippled language because it is a crippled language - (tablizer) - (17)
                                         I have always considered C to be . . . - (Andrew Grygus) - (15)
                                             I disagree. - (admin) - (1)
                                                 ICLPRD (new thread) - (static)
                                             Nah, Pascal was a teaching language - (hnick) - (5)
                                                 According to Nicholas Wirth he did not . . . - (Andrew Grygus) - (4)
                                                     So who are you going to believe? - (hnick) - (2)
                                                         Nah, you probably won't: "Argument". HTH! :-) -NT - (CRConrad)
                                                         Early versions had only 16-bit integers . . . - (Andrew Grygus)
                                                     Maybe not originally, but when he wrote Modula II - (jb4)
                                             I gotta say that... - (jb4) - (6)
                                                 It's that stupid single exit point from a function - (crazy) - (5)
                                                     I've got NO PROBLEM with that - (jb4) - (4)
                                                         You ever have nested while and for loops? - (crazy) - (3)
                                                             "Numereous flags" - (jb4) - (1)
                                                                 Didn't think so? - (crazy)
                                                             That's a good way out. - (static)
                                         It is not the pinochle of procedural by a longshot, either. -NT - (jb4)
                                 All these years and you still misunderstand my opinion - (tablizer) - (2)
                                     Not misunderstand ... DISAGREE -NT - (drewk) - (1)
                                         If something is objectively better, then you should show why -NT - (tablizer)
         Perhaps, more examples of naivity? - (warmachine) - (1)
             Lots of 'em-they're the very ones I want him to (re)consider -NT - (CRConrad)

In conclusion, lithium in the water supply.
80 ms