Are there any plans to introduce a non-escaping an...
# language-proposals
h
Are there any plans to introduce a non-escaping anotation to disable escaping variables of a lambda?
j
For what purpose?
How would it interact with other language features or functions to make some use case better?
h
To disallow escaping a parameter outside of its lambda/context. I found the issue: https://youtrack.jetbrains.com/issue/KT-15514
Copy code
fun <R> executeQuery(
  sql: String,
  mapper: (SqlCursor) -> R,
  binders: (SqlPreparedStatement.() -> Unit)?
): R

var cursor: SqlCursor? = null
executeQuery("", mapper = { 
  cursor = it // this is a misuse of the API, but it is possible! 
}, null)
j
k
Could also be useful for stuff like
chunked
and
windowed