Re: The distinction between "do BLOCK while COND" and "EXPR while COND" should go
[email protected] ("Christopher J. Madsen") Thu, 31 Aug 2000 14:56:45 -0500 (CDT)
| Newsgroups | perl.perl6.language.flow |
|---|---|
| Message-ID | <[email protected]> |
Tom Christiansen writes:
> >Yes, but 'eval' has the semantics "run this code but don't let it play
> >any funny tricks on me, like dying or anything", where 'do {...} while'
> >has the semantics "a while loop that evaluates its condition at the
> >end". There's no obvious reason why 'return' should behave
> >differently in a 'do while' loop than it does in a 'while' loop.
>
> I (well, Perl) really think of do{} much more as a construct that's
> kin to eval{} and sub{}. It just has a strange effect on postfix
> while/until checks, altering when they're consulted.
I realize that, and that's why 'last' & friends don't currently work
in do loops. But programmers used to C expect 'do ... while' and
'while' to be almost equivalent, and I think most Perl programmers do
too. (They may realize now that it's not true, but I still think it's
what they originally expected.) Making 'last' work would cater to
that expectation. Changing the way 'return' works is counter to it.
--
Chris Madsen http://www.trx.com [email protected]
TRX Technology Services (214) 346-4611