dalexander
09/28/2016, 6:23 PMfun someFunction() {
  val email = client?.personalInfo?.email
  // assuming message is a val, otherwise it may need similar treatment
  if(email != null && message != null) { mailer.sendMessage(email, message) }
} is how I would change the above statement to take advantage of Kotlin’s smart casting.  If email is method-local in this case then it’s safe from other threads modifying it, even if client.personalInfo.email gets changed in the meantime.