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.

Loops returning values would competite more with greps and maps than functions. You are right that sometimes they would make the code harder to read but sometimes easier. So, they should be user only in latter case.


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.

Thanks for engouraging! I try to develop something but don't promise anything. I try to remenber to inform You and other on the list if i manage to get something ready - and if i still found it as usefull as i think now when i have used it a while :)


ville jungman, 2 laureston crescent, tower, blarney, cork, ireland
tel. + 353 - 21 - 451 6847, http://www.kolumbus.fi/vilmak
usko Herraan Jeesukseen, niin sinä pelastut. (apt. 16:31)





From: "R. Joseph Newton" <[EMAIL PROTECTED]>
To: Ville Jungman <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: Should loops return a value?
Date: Fri, 26 Sep 2003 19:41:18 -0700

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]


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to