You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "mg (JIRA)" <ji...@apache.org> on 2017/08/27 14:50:00 UTC
[jira] [Updated] (GROOVY-8302) Delete me
[ https://issues.apache.org/jira/browse/GROOVY-8302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
mg updated GROOVY-8302:
-----------------------
Priority: Trivial (was: Major)
Description: (was: This proposal revisits the idea to change the semantics of the break, return, and continue keyword for closures that are used in a way that mimics classical Java block constructs such as if, for, or while.
Example 1:
{code}
// Iterate over all PERSON rows in the result set
sqe.forEachRow("select * from PERSON") { final row ->
if(row.TAG == 0) { break } // Leave forEachRow loop
if(row.TAG == 1) { return } // return from the method enclosing the forEachRow loop
if(row.TAG == 2) { continue } // Move to next iteration in the forEachRow loop
}
{code}
Example 2:
{code}
// Encapsulate with statically imported helper method that catches exceptions and ignores them, if the passed parameter is true
execWithOptionalIgnoreErrors(ignoreErrorsQ) {
final x = dangerousOperation()
if(x == 1) { return } // return from the enclosing method
// Note: break & continue are not allowed here
}
{code})
Component/s: (was: Compiler)
Summary: Delete me (was: break/return/continue support in "Appended Block Closures")
> Delete me
> ---------
>
> Key: GROOVY-8302
> URL: https://issues.apache.org/jira/browse/GROOVY-8302
> Project: Groovy
> Issue Type: Proposal
> Reporter: mg
> Priority: Trivial
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)