------------------------------------------------ On Fri, 26 Sep 2003 16:21:56 +0300, "Ville Jungman" <[EMAIL PROTECTED]> wrote:
> >Not crap, just unnecessary. If the loop should arrive at a value to be > >returned, it should probably be enclosed in a function, which was designed > >for > >returning values. > > Everything is unnessessary because always code could be made with machine > language or assember - latter of course is unnessessary in that case. > > If loops returned values the point was they returned them like other > commands or functions and it wouldn't ne necessary to enclose it in a > function. Like this: > > @a=while(...){...} > > or even like this: > > $answer= > while( > foreach(@a,while{...}) > ) + # loops return values have to be in scalar context when using > +, -, * etc > while( > foreach(...),while(...) > ) > > These might need a programmers to change their programming habits a little > bit, but i think it'd be worth of it. (Of course one can code in old way, > too.) > Interesting discussion, I am not convinced of the value yet, but then again most of my experience is in Perl and so wouldn't have really thought to do it, so always open to something new... No one has mentioned 'eval' that I have seen in this little discussion, couldn't it be used to wrap the while loop so that it would appear to return a value to be caught? my $return; $return = eval { while ( ) { } }; Of course then you deal with compile/runtime issues, checking $@, etc. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]