On Mon, 13 Nov 2006, S. Robert James wrote:

> Thanks.
>
> Wow!  That's an example of clever code.  The code's less clear, no
> shorter, and confusing to someone not familiar with this new method -
> and for what? To be able to show off cool meta programming?
>
> I think Rails is great, but someone needs to remind people that "clever
> code" is an insult.

nothing clever about it afaikt - made sense instantly: it's a factory method.
i use this idiom in code all the time

   def m
     ret = Array.new

     ...

     return ret
   end

or even

doesn't make sense for short methods, but once they reach 20/30 lines and have
complex logic is really nice to see up front what a method returns.  it's the
same reason some people prefer

   char *hostname();

over

   def hostname()

a refinement of

   def m
     Object.new.instance_eval{
       configure @object
       self
     }
   end

which can make debugging hard due to having two scopes in the method body


in summary you know at a glace what's being returned - that's quite useful
sometimes.

-a
-- 
my religion is very simple.  my religion is kindness. -- the dalai lama