title: Function returning ad-hoc object in Kotlin
body: <p>Currently I have a private function which returns a <code>Pair&lt;User, User&gt;</code> object. The first user is the sender of something, the second user is the receiver of that thing.</p>
  
  <p>I think this <code>Pair&lt;User, User&gt;</code> is not enough self explanatory - or clean if you like - even though it's just a private function.</p>
  
  <p>Is it possible to return with an ad-hoc object like this:</p>
  
  <pre><code>private fun findUsers(instanceWrapper: ExceptionInstanceWrapper): Any {
      return object {
          val sender = userCrud.findOne(instanceWrapper.fromWho)
          val receiver = userCrud.findOne(instanceWrapper.toWho)
      }
  }
  </code></pre>
  
  <p>and use the returned value like this:</p>
  
  <pre><code>// ...
  val users = findUsers(instanceWrapper)
  users.sender // ...
  users.receiver // ...
  // ...
  </code></pre>
  
  <p>?</p>
  
  <p>If not, what's the point of ad-hoc object in Kotlin?</p>