• 로그인 함 해보끄나?

  • Sarangnamu.net June 17, 2003
    Home Login Profile Study Open Project Q&A Google Code
    kotlin crossline
    https://kotlinlang.org/docs/reference/inline-functions.html
    
    일부 인라인 함수에 전달된 lambda 함수를 본문에 직접 호출하지 않고 다른 context 에서 호출 가능 하게 할 수 있는데 이러한 경우 
    crossline 으로 표시해야 한다고 함 
    
    Note that some inline functions may call the lambdas passed to them as parameters not directly from the function body, but from another execution context, such as a local object or a nested function. In such cases, non-local control flow is also not allowed in the lambdas. To indicate that, the lambda parameter needs to be marked with the crossinline modifier:
    
    inline fun f(crossinline body: () -> Unit) {
        val f = object: Runnable {
            override fun run() = body()
        }
        // ...
    }
    
    break and continue are not yet available in inlined lambdas, but we are planning to support them too.

    Comment


    입력하3 1513136145



    Locations of visitors to this page