# Public review of the Standard Library APIs \[Closed\]

**URL:** <https://discuss.kotlinlang.org/t/public-review-of-the-standard-library-apis-closed/1362>\
**Category:** Libraries\
**Created:** [December 17, 2015, 1:32pm UTC](https://discuss.kotlinlang.org/t/public-review-of-the-standard-library-apis-closed/1362 "2015-12-17T13:32:41Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![pniederw1](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pniederw1](https://discuss.kotlinlang.org/u/pniederw1)\
**Post date:** [December 18, 2015, 9:21pm UTC](https://discuss.kotlinlang.org/t/public-review-of-the-standard-library-apis-closed/1362/13 "2015-12-18T21:21:59Z")

</div>

We keep having a hard time with `T.run` vs. `with` vs. `let`. These three “global” functions sound very different, but actually only differ in “cosmetics”. Almost always any of them _can_ be used, and it’s unclear which to prefer. This regularly leads to debates in code reviews. Furthermore, it’s not intuitive why it’s `with(foo)` vs. `foo.run`. (In fact, this seems to be the only difference between the two!)

On the other hand, we sometimes miss the ability to access the receiver of `apply` as a function argument. For example, `val foo = Foo().apply { configure(it) }` feels more natural than `val foo = Foo().apply { configure(this) }`. We use `apply` more often than any of the other methods.

I hope there is a way to unify these methods, or make their similarity and distinctions more apparent, that removes a lot of this guesswork. I made one proposal in [Let vs. with vs. run - #2 by ilya.gorbunov](https://discuss.kotlinlang.org/t/let-vs-with-vs-run/30/2). Another idea that comes to mind is to remove one of `T.run` and `with`, although this still leaves `with` vs. `let`.

If no other solution is found, damage could be reduced by having KDoc explain the rationale and intended use cases for each method, rather than just paraphrasing the code.

---

_[View the full topic](https://discuss.kotlinlang.org/t/public-review-of-the-standard-library-apis-closed/1362)._
