Permalink
Browse files

"Opposite" for with called let.

  • Loading branch information...
shafirov committed Apr 30, 2013
1 parent 1ddc537 commit a9638d9fa4fbda85e5f97275bdab5f4c3fcbdda3
Showing with 5 additions and 0 deletions.
  1. +5 −0 libraries/stdlib/src/kotlin/Standard.kt
@@ -56,3 +56,8 @@ public inline fun <T> run(f: () -> T) : T = f()
* Execute f with given receiver
*/
public inline fun <T, R> with(receiver: T, f: T.() -> R) : R = receiver.f()

/**
* Converts receiver to body parameter
*/
public inline fun <T:Any, R> T.let(f: (T) -> R): R = f(this)

0 comments on commit a9638d9

Please sign in to comment.