From: dblack@... Date: 2003-05-06T23:18:29+09:00 Subject: Re: Suggestion: String#pack Hi -- On Tue, 6 May 2003, Austin Ziegler wrote: > I have been working on some code recently where it would be very > useful to do: > > "abcdef".pack(...) > > Instead, I have to do: > > ["abcdef"].pack(...) > > This is guaranteed to be at least a minor inefficiency because a > temporary anonymous array needs to be created. Is there a good reason > why String can't have a #pack method that Does The Right Thing? I approach this with trepidation, because (un)pack is one of these things that I have to look up and talk myself through every time I use it... but, for what little it's worth, I always thought there was a pretty direct and sensible idea behind this, namely that one packed things into a string and unpacked them into an array. So the idea of packing a string into a string seems off-by-one to me, logically -- a little too "magic". I'd put it (with the above trepidation :-) in the same category as a hypothetical Array#split, say, which auto-joined the array on '' and then split the resulting string. David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav