Hi.
Having just discussed variances in readability between Python and Ruby
with a ex-co-worker while shopping frozen pizza, I went on and used the
array to parameter list expansion operator:
a = ParseDate.parsedate("2001-05-25") #=> [2001,05,25,nil,nil,...]
date = Date.new( *a[0..2] )
which makes all the C/C++ pointer dereferencing hairs stand on end along
my neck (*shudder*)
Now, I know I can do this the tedious way:
date = Date.new( a[0],a[1],a[2] )
but I was wondering if there was a more readable option to use in cases
where I can't specify the number of arguments in advance.
I'm basically wondering if there is an Array#to_parameter_list or
equivalent?
( I also have a similar feeling towards the & for block parameters, but
then I tend to use proc explicitly when dealing with callbacks that
don't yield, but call or store the block. )
--
<[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]>
)____(stud.techn.;ind.шл.data)||(softwareDeveloper.at(Trustix))_(
/"Opinions expressed are mine and not those of my Employer, "\
( "the University, my girlfriend, stray cats, banana fruitflies, " )
\"nor the frontal lobe of my left cerebral hemisphere. "/