Aladdin - Scala Bugtracking
[#914] project: documentation priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-01-28 22:54:32.0
subject [contrib #310] Return Expressions
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.

what happened
what expected contribution #310
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-01-28 23:01:23.0
Martin  edited on  2007-01-29 17:05:18.0