From: Pixel Date: 2001-12-11T04:34:38+09:00 Subject: [ruby-talk:28130] Re: How does puts decide how to print a given object? matz@ruby-lang.org (Yukihiro Matsumoto) writes: > (3) unlike other objects, arrays are sometimes very big. imagine > the code like 'puts File.readlines("bigfile")'. calling to_s > inside wastes huge memory region. one solution is to use stream a la C++: def puts_powered(*l) l.each{|o| if o.respond_to?("to_io") then o.to_io($defout) else puts(o.to_s) end } end but it may be overkill/not good for compatibility... -- Pixel programming languages addict http://merd.net/pixel/language-study/