in reply to Re^4: Useful uses of redo?
in thread Useful uses of redo?
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.
|
|---|