Readability: Verbose version of *arrayToParameter expansion? 
Author Message
 Readability: Verbose version of *arrayToParameter expansion?

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.*-*-*.com/ ~kentda/ ]>
  )____(stud.techn.;ind.?k.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.           "/



Thu, 22 Apr 2004 11:59:06 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Windows ruby(cygwin version) Command Expansion Problem

2. Windows ruby(cygwin version) Command Expansion

3. Test::Unit verbose mode

4. val-comp.hlp not big, just verbose

5. verbose

6. Howto: testall not in verbose mode

7. Verbose REs, Python quick ref

8. 1.4b3 importdl.c verbose flag

9. A more verbose catch?

10. are *LOAD-VERBOSE* and friends recursive?

11. clock format %Z option produces verbose output

12. I feel stoopid ... this code is to verbose

 

 
Powered by phpBB® Forum Software