From: Robert Klemme Date: 2005-01-10T23:51:20+09:00 Subject: Re: Construct [*nil] works differently in 1.6 and 1.8 "Christian Neukirchen" schrieb im Newsbeitrag news:m2d5wde75h.fsf@lilith.local... > "Robert Klemme" writes: > > > "Christian Neukirchen" schrieb im Newsbeitrag > > news:m2hdlqeb11.fsf@lilith.local... > >> "Robert Klemme" writes: > >> > >>> "Christian Neukirchen" schrieb im Newsbeitrag > >>> news:m2pt0eeubv.fsf@lilith.local... > >>>> > >>>> Hello, > >>>> > >>>> do you maybe also know a nice trick to make it a single-element Array > >>>> iff it's not already an Array? > >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > Ooops, sorry, I overread that. Then of course my proposal is not a > > solution. > > > > Btw, for what do you need that? Just curious... > > I needed that rather often for convenience stuff (pass a single > argument or a whole array of them etc.). Ah, I see. But for methods arguments it works quite good, doesn't it? >> def f(*a) p a end => nil >> f( "aa\nb" ) ["aa\nb"] => nil >> f( "aab" ) ["aab"] => nil >> f( "aab", "bb" ) ["aab", "bb"] => nil >> f( 1,2,3 ) [1, 2, 3] => nil > When I used [*ary] to do that, I had some "mysterious bugs" that only > appeared if the particular string had a newline in it... it really > took me some time to find those bugs. I imagine... Kind regards robert