From: Hugh Sasse Staff Elec Eng Date: 2003-09-11T19:02:21+09:00 Subject: Re: What *are* variables? Which are nil now? On Thu, 11 Sep 2003, Robert Klemme wrote: > > "Hugh Sasse Staff Elec Eng" schrieb im Newsbeitrag > news:Pine.GSO.4.53.0309110023200.26201@neelix... > > I found out what caused it: > > @dirs += entries.collect{|f| stuff_here(f)}.compact! > > > > The bang method caused the blow up, but even defining > > [Nil#to_a] > > > > did not trap it. > > Where does the "#<"..."failed to convert nil to Array"...> > > message come from? Somewhere untrappable? > > Since > > @dirs += entries.collect{|f| stuff_here(f)}.compact! > > <=> > > @dirs = ( @dirs + entries.collect{|f| stuff_here(f)}.compact! ) > > Assuming that @dirs is an Array, Array.+ tries to convert the argument > (which is the result of the expr right to the "+") to an Array and throws > the exception Agreed, but is the point where the message is generated accessible, such that I can interpose something? This Array#+ isn't calling arg.to_a as far as the above shows... > > Cheers > > robert Hugh