Created
July 9, 2018 09:50
-
-
Save sajjadyousefnia/7f85da7083f03d7a8807e779140b87ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public inline fun <T, R> with(receiver: T, block: T.() -> R): R { | |
contract { | |
callsInPlace(block, InvocationKind.EXACTLY_ONCE) | |
} | |
return receiver.block() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment