4 ms·
Groovy has it too. http://mrhaki.blogspot.dk/2009/08/groovy-goodness-safe-navigation-to.html http://mrhaki.blogspot.dk/2009/08/groovy-goodness-safe-navig...
by biehl 11y ago
Groovy has it too.
http://mrhaki.blogspot.dk/2009/08/groovy-goodness-safe-navigation-to.html http://mrhaki.blogspot.dk/2009/08/groovy-goodness-safe-navig...
- vorg 11y ago> http://mrhaki.blogspot.dk/2009/08/groovy-goodness-safe-navigation-to.html http://mrhaki.blogspot.dk/2009/08/groovy-goodness-safe-navig... August 2009 is a long time ago, when Groovy 1.6 was the current version. The month before, Groovy's creator published a blog saying if he'd known about Scala he would never have created Groovy. And during the following month, Alex Tkachman published his first blog outlining his plans for Groovy++, which was eventually duplicated as the static typing facility in Groovy 2.x. > println company?.address?.street?.name I haven't used the Codehaus/Apache edition of Groovy since version 1.8 when there had been plenty of mailing list discussions about enabling ?. functionality to ripple through all subsequent . after the first use of ?. so that: println company?.address.street.name would be behave the same. Was this much talked about functionality ever implemented? Edit: Looks like the Haskell Maybe monad described by Arguggi in the other thread goes even one better than that by not even requiring their equivalent of ?. in the path at all but instead the typing system infers whether to use . or ?. functionality from the type of each field (company, address, and street in the example). I remember a mailing list discussion in the early days of Groovy begun by its creator James Strachan about whether to use some new syntax to require an object to be assigned to a variable: Object! ob= new Object() //can't be null Object ob //can be null Unfortunately, he was, er, replaced by the current management soon afterwards.