code |
This is one of a few issues reporting minor concerns regarding The Scala Language Specification, as supplied with 2.3.3.
6.18 Return Expressions
This section does not mention what happens in the event of nested named methods or functions.
Perhaps
A return expression return e must occur inside the body of some enclosing named
method or function f . This function must have an explicitly declared result type, and the type of e must conform to it. The return expression evaluates the expression e and returns its value as the result of f .
should be
A return expression return e must occur inside the body of some enclosing named
method or function. The innermost enclosing named method or function, f, must have an explicitly declared result type, and the type of e must conform to it. The return expression evaluates the expression e and returns its value as the result of f .
The section also doesn't mention what happens when the named method or function has already returned. Something like the following could be added:-
If f has already returned, a scala.runtime.NonLocalReturnException is thrown.
|