Unify functional parameter name for 'let', 'run', 'with', 'apply' scope function with 'use' and 'synchronize'.
This commit is contained in:
@@ -22,26 +22,26 @@ public fun TODO(reason: String): Nothing = throw NotImplementedError("An operati
|
||||
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] and returns its result.
|
||||
* Calls the specified function [block] and returns its result.
|
||||
*/
|
||||
public inline fun <R> run(f: () -> R): R = f()
|
||||
public inline fun <R> run(block: () -> R): R = block()
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] with `this` value as its receiver and returns its result.
|
||||
* Calls the specified function [block] with `this` value as its receiver and returns its result.
|
||||
*/
|
||||
public inline fun <T, R> T.run(f: T.() -> R): R = f()
|
||||
public inline fun <T, R> T.run(block: T.() -> R): R = block()
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] with the given [receiver] as its receiver and returns its result.
|
||||
* Calls the specified function [block] with the given [receiver] as its receiver and returns its result.
|
||||
*/
|
||||
public inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
|
||||
public inline fun <T, R> with(receiver: T, block: T.() -> R): R = receiver.block()
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] with `this` value as its receiver and returns `this` value.
|
||||
* Calls the specified function [block] with `this` value as its receiver and returns `this` value.
|
||||
*/
|
||||
public inline fun <T> T.apply(f: T.() -> Unit): T { f(); return this }
|
||||
public inline fun <T> T.apply(block: T.() -> Unit): T { block(); return this }
|
||||
|
||||
/**
|
||||
* Calls the specified function [f] with `this` value as its argument and returns its result.
|
||||
* Calls the specified function [block] with `this` value as its argument and returns its result.
|
||||
*/
|
||||
public inline fun <T, R> T.let(f: (T) -> R): R = f(this)
|
||||
public inline fun <T, R> T.let(block: (T) -> R): R = block(this)
|
||||
|
||||
Reference in New Issue
Block a user