Last active
December 16, 2015 12:48
-
-
Save rsslldnphy/5436915 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Nils - what are your Options?" - Russell Dunphy | |
Tony Hoare, inventor of the null reference, calls it his "billion dollar mistake". | |
Although Ruby goes some way to correcting it by making `nil` at least be a class | |
with some reasonably helpful stuff on it, you'll no doubt have been hit by a | |
`NoMethodError: undefined method 'foo'` just as many times as me. | |
So, given this problem exists, I want to convince you of a few things. | |
First, that there are not one, but two types of `nil`. | |
Second, that they are not a necessary evil - we can do something about them. | |
I'll be showing you Options, an idea taken from the world of functional programming, | |
and showing how you can apply them in your Ruby code, and why you'd want to do so. | |
And if there's time, I'll take a quick detour into pattern matching - another cool | |
trick from FP - showing why it's helpful when dealing with Options, and perhaps even | |
the incredibly cool way Erlang uses it in method dispatch. | |
Looking forward to seeing you there! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment