From: timr Date: 2010-11-12T11:05:21+09:00 Subject: Re: what's an object? On Nov 11, 12:59 am, Ammar Ali wrote: > On Thu, Nov 11, 2010 at 10:51 AM, Brian Candler wrote: > > One other point. A local variable is not an object and never is - > > I think that's too general and confusing, at least to me. > > >> def m > >>   a = [1,2,3] > >>   p a.is_a?(Object) > >>   end > => nil > >> m > > true > => true > > Is there more insight behind that statement? Or am I missing something > fundamental? > > Thanks, > Ammar Hi Ammar, I do think the code means something different than you are interpreting it to mean. obj.is_a?(Object) asks if Object is listed in the ancestors of obj. It is another way of saying obj.class.ancestors.include?(Object) Everything you can send a message to in ruby is a descendent of Object, so it will always be true, er, I predict. However, when you ask a local variable (which is really a pointer to, in your case, an instance of Array) you are asking is Object listed in the ancestors of the Array class? It doesn't ask if a variable considers itself an instantiated object. Tim