On Thu, 2014-02-27 at 20:49 +0000, deadalnix wrote: > On Thursday, 27 February 2014 at 13:27:14 UTC, Remo wrote: > > > > Apparently C# will get it in the next version. > > http://blogs.msdn.com/b/jerrynixon/archive/2014/02/26/at-last-c-is-getting-sometimes-called-the-safe-navigation-operator.aspx > > > > What do you think how well would this work in D2 ? > > Chaining . operation is a code smell to begin with, and having > everything nullable is dubious as well. This is fixing a problem > that shouldn't exists to begin with.
>From the responses, this is clearly an emotive issue, but chaining . operations and using fluent interfaces is only a code smell to those people who think it is a code smell. Many people think exactly the opposite and that not using chaining where is can be used is a code smell. Groovy has had safe dereferencing for a long time, as have other dynamic languages, C# is coming very late to this game. Any design decision for D needs to look wider than the C# debate, theoretical examples and philosophizing, to actual use in real situations by languages that have chosen to realize this idea. My experience from Groovy, which is relatively limited in that I am not involved in end-client applications only in maintaining and developing Groovy, GPars and Gant, indicates that it is a very helpful tool, analogous to the whole Maybe/Option stuff in pure functional languages. Groovy is now able to probe the issue of whether this operation is as useful/applicable in a statically compiled context as in a dynamic context since the @TypeChecked and @CompileStatic AST transforms allow Groovy to be a static language as Java, Scala, Ceylon, Kotlin are, as well as being a dynamic language as JRuby, Jython, Clojure are. No results as yet though as the experiments have not been explicitly tried. Thus there is no explicit data to reflect on. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
