Mea culpa. Actually, the example code I typed in doesn't make much sense in any case. I should have taken the time to produce a tested example.

I wasn't trying to disprove anything, just commenting in keeping with the thread. However, perhaps I should state my objection more directly. The transition from test-before to test-after is (to my knowledge) unique with this combination of do BLOCK and while. In every other case, the modifier is evaluated before the statement that is modified.

I understand (or at least I think I do), that this was done to provide for the pascal-style test-after loop construct. My problem with the decision to ban the while modifier on do blocks is that it is (IMO) the wrong way to fix the misconception that I so nicely fell into with my examples.

I think that the misconception arises because in every other case, substituting a do block for a single statement has exactly the effect of grouping its contained statements that one expects. So, it's the special case that causes the problem.

So rather removing what would otherwise be a useful construct, I'd prefer that the special case was removed.

As the loop keyword has been designated, would it be too confusing to use

loop{ ... } while condition;
?

Don't feel the need to debate this further. I missed (and haven't found despite having looked for the original decision point a couple of times), the arguments behind the decision, but I accept that you've probably given this much more thought than I, and you usually get these things right.

I also fit in that camp of people that would like to use multiple statement modifers, but accept you have good reasons for your distaste for those also.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re^5: Useful uses of redo? by BrowserUk
in thread Useful uses of redo? by kvale

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.