From: Robert Klemme Date: 2008-06-09T19:50:59+09:00 Subject: Re: Ruby wishlist 2008/6/8 jzakiya : > On Jun 8, 5:05 am, Robert Klemme wrote: >> On 08.06.2008 06:00, jzakiya wrote: >> > I want to set multiple variable to the same value: >> >> > n1, n2, n3, n4 = 5 >> >> Your variable naming indicates that you are probably using the wrong >> tool: you rather want an Array of values vs. a number of variables. If >> you do that, life becomes much easier: >> >> > and do +=, -=, *=, etc with the same value >> >> > n1, n2, n3, n4 += 5 >> >> ns.map! {|n| n + 5} > > The names of the variables are not array values, they > are just different variable names, they could be any > names. The names are irrelevant: the mere fact that you want to treat them uniformly indicates that it is a bad idea to have them as separate local variables and not in some type of collection. > Remember, I would LIKE ruby to be able to do this. > It is my "whishlist". I know Ruby doesn't do it now, > but I would like it to be able to in the future. OK! :-) The question is whether it is *reasonable* to build this into the language. It does not make sense to put something into the language to support a) an esoteric case or b) sub optimal design. Kind regards robert -- use.inject do |as, often| as.you_can - without end