Permalink
Browse files

KT-3557: with() made it to stdlib

  • Loading branch information...
shafirov committed Apr 30, 2013
1 parent d53e8bb commit 666cc6e6884643a404b40e33f283a6216551e6a5
Showing with 5 additions and 0 deletions.
  1. +5 −0 libraries/stdlib/src/kotlin/Standard.kt
@@ -51,3 +51,8 @@ public inline fun <A,B> A.to(that: B): Pair<A, B> = Pair(this, that)
Run function f
*/
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()

0 comments on commit 666cc6e

Please sign in to comment.