On 2014-06-18 11:55 AM, bearophile wrote:
Etienne:

writeln(obj.member?.nested?.val);

What about an approach like Scala instead?

Bye,
bearophile

You mean like this?


http://stackoverflow.com/questions/1163393/best-scala-imitation-of-groovys-safe-dereference-operator

def ?[A](block: => A) =
  try { block } catch {
case e: NullPointerException if e.getStackTrace()(2).getMethodName == "$qmark" => null
    case e => throw e
  }

val a = ?(b.c.d.e)

Reply via email to