What is so clever about a nil object check?
I suppose if you're using it to make skirting the "Law of Demeter" and thats something you don't want to do it could seem like something bad.
But I'll take "foo?.bar()" over "foo.bar() if foo" gladly.
I suppose if you're using it to make skirting the "Law of Demeter" and thats something you don't want to do it could seem like something bad.
But I'll take "foo?.bar()" over "foo.bar() if foo" gladly.
That's easy enough to remember, though.
I found myself trying to decide whether or not to use it the other day and decided for now it was too clever. So I guess the jury is out in my own head, maybe not in anyone else's.