--001485f8721ce2c85c046c540a39
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sun, Jun 14, 2009 at 1:29 PM, Trans <transfire / gmail.com> wrote:

> I don't see how the former is ever of any use, but the later certainly
> is. am i missing something obvious?
>

The main use I've seen is for iterating hashes, e.g.:

>> {:a 1, :b 2, :c 3}.map { |k, v| "#{k}v}" }.join(",")
"b c0a

Of course you could always massign against an incoming array, so this case
is also covered by:

>> {:a 1, :b 2, :c 3}.map { |(k, v)| "#{k}v}" }.join(",")
"b c0a

The massign approach is nice with methods where you want to explode an array
as arguments alongside other arguments:

>> {:a 1, :b 2, :c 3}.inject(0) { |n, (k, v)| n + v }
6

Personally I'm not a fan of this mode of arity handling and think massign
and splats cover all the cases where it's useful.

-- 
Tony Arcieri
medioh.com

--001485f8721ce2c85c046c540a39--