Re:A Year’s Worth of Opinions about Objective-C
by icebraining on Saturday December 14, 2013 @11:21AM
(#6906048)
Well, Python is duck typed, but None doesn't pretend to be a duck, a cow, a pig, etc. That sounds extremely dangerous.
[ Parent
| on HN ]
Re:A Year’s Worth of Opinions about Objective-C
by drewcrawford on Saturday December 14, 2013 @12:20PM
(#6906250)
In C/C++, dereferencing the null pointer is undefined. That is a hell of a lot more dangerous than doing nothing. ObjC's "defined to do nothing" behavior is a significant step up from the other languages in the "fast, compiled, bare metal" cluster (C,C++).
Re:A Year’s Worth of Opinions about Objective-C
by Iftheshoefits on Saturday December 14, 2013 @02:43PM
(#6906808)
It's rather subjective to say that's a "significant step up". "Dereferencing a null" indicates a potentially serious underlying issue that the "do nothing" hand-holding you describe masks.
Re:A Year’s Worth of Opinions about Objective-C
by dilap on Saturday December 14, 2013 @11:37AM
(#6906108)
nil just always comes back with 0 or nil or whatever -- it's like a really dumb version of None in the Maybe monad, and trying to get you some of the convenience (except way, way worse from a safety perspective).
For extra fun, NSNull (the "designated" object (as opposed to an actual zero value of nil) to represent nil) doesn't happily respond to any message sent to it -- i.e., if you replace nil with NSNull somewhere in the code, it will most likely blow up.