On Wed, 19 Oct 2005, Peter Fitzgibbons wrote:

> def mymethod
>  a = someobjectreference('a')
>  if a.nil?
>    return nil
>  end
>  b = a.someattribute_might_be_nil
>  if b.nil?
>    return nil
>  end
>  c = b.someattribute_might_be_nil
>  if c.nil?
>    return nil
>  end
>  c.dosomething
> end

class NilObject
   def someattribute
     nil
   end

   def dosomething
     nil
   end
end

def mymethod
   someobjectrefence('a').someattribute.someattribute.dosomething
end


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.