Ville Jungman wrote: > >From: "Hanson, Rob" <[EMAIL PROTECTED]> > >If you really want a loop to return something, you can roll your own, even > >in Perl 5... but the syntax won't be as you gave. > > Ye - i'm not searching a way to solve a single problem but trying to make > programming easier. If loops returned values it would make the whole coding > much clearlier and better structured - at least i believe so. It'd b easy to > just watch a code and say what it's doing in many cases. Look at what You > write below; it is of course clever code but cleverness and hacks often > makes code hard to debug or read particularly when programs grow.
I guess tastes differ. Particularly as to what constitutes readability and hacks. I prefer natural language. To me, while means just that--do something while some condition pertains. I see nothing in the word to suggest a value being returned, or to imply which value is the "natural" one to return. The return value strikes me more as an unexpected side effect. That was also why I dumped the abbreviations. Takes much less energy to type a few extra characters than to squint your eyes and try to figure out which real words the abbreviations were meant to stand for [usually an infinite variety of possiblities.] A well-named function, on the other hand, tells you exactly what to expect. Ealy binding of parameters to local variables also adds clarity by providing concrete meaning to the parameters offered. Whatever works for you, works for you, I guess, and you will have the opportunity to demonstrate the efficacy of this approach when Perl 6 comes along. Meantime, I will continue writing code that says what I mean--which means using well-named functions and variables. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]