4 ms·
If only there was some combinator for sequencing computations... then you could write: foo >>= bar >>= baz >>= quux and there would never be a NullPointerE
by jrockway 17y ago
If only there was some combinator for sequencing computations... then you could write:
foo >>= bar >>= baz >>= quux
and there would never be a NullPointerException, because the >>= function could react appropriately when null was encountered!
- KirinDave 17y agoYou win at the "Most Subtle Haskell Reference" in this conversation.
- cujo 17y agoSince I don't know haskell, I'll throw out that groovy does this too. foo?.bar()?.baz?.quux What other languages have this kind of shortcut?
- aquadoctorbob 17y agoCoffeeScript: http://jashkenas.github.com/coffee-script/#existence http://jashkenas.github.com/coffee-script/#existence
- grayrest 17y agoSince coffeescript was mentioned, the Ruby andand library is also frequently mentioned when this comes up. (I only ruby for Rake).
- doki_pen 17y ago$ irb >> def nil.method_missing *args >> nil >> end => nil >> a = nil => nil >> a.b.c.d => nil >>