News for hackers. Stuff that matters.
Re:Evil Ruby by Mon_Ouie on Wednesday January 23, 2013 @07:19AM (#5102697)
Methods that simply behave differently depending on whether or not an argument is given. For example, passing nil (or any other object) to inject is different from passing nothing.

     [1, 2, 3].inject(:+)
     [1, 2, 3].inject(0, :+)
     [1, 2, 3].inject(nil, :+) # doesn't work
Rubinius uses a magic ``undefined`` value for this:

     def inject(initial=undefined, sym=undefined, &block)

There are no comments on this comment yet.