Hi --

On Tue, 12 Dec 2006, Robert Klemme wrote:

> On 12.12.2006 14:31, Dave Thomas wrote:
>> 
>> On Dec 12, 2006, at 4:10 AM, Robert Klemme wrote:
>> 
>>> I have low expectations with regard to the "else" clause but the book 
>>> clearly states that it is executed if there was no exception - that 
>>> includes the case where the block is left via a "return".  Behavior and 
>>> description simply are not in sync, that's my point.
>> 
>> Interesting: I'd honestly never have thought of that interpretation. I 
>> guess in my mind, the semantics of return take precedence over most other 
>> semantics, and I explicitly note the times where that's not the case. 
>> Thanks for pointing out an alternative.
>
> Dave, you're welcome!  I was probably in formal mode when reading that, 
> although I believe the situation here is a tad different from the "while" 
> loop case:
>
>> Do you feel I should also document the other places when a return could be 
>> issued? For example, in the description of a while loop, I say "executes 
>> body zero or more times as long as boolean-expression is true."  Should I 
>> add "or a return is executed or an exception is thrown" to this and similar 
>> descriptions?
>
> Maybe just "... or the body of the loop is left via other control flow 
> statements".  You could even add a footnote which enumerates them. :-)

I don't think that's needed.  Executing a body of code means executing
all the instructions in it, and it's already known that the
instruction set includes things that affect flow control.  So unless
those things are specifically excluded in a given context, I would
assume they are available.


David

-- 
Q. What's a good holiday present for the serious Rails developer?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    aka The Ruby book for Rails developers!
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)