[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Hash#rekey

Yukihiro Matsumoto

2/6/2007 7:35:00 AM

Hi,

In message "Re: Hash#rekey"
on Mon, 5 Feb 2007 07:34:49 +0900, "Trans" <transfire@gmail.com> writes:

|I used 'normalize_keys' for while, but how doesn't 'rekey' fit the
|behavior? The hash is being rekey'd.

For me, 'rekey' is meaningless. Coined word need guessing, which is
considered harmful unless it is accepted by many.

matz.

3 Answers

Martin DeMello

2/6/2007 12:34:00 PM

0

On 2/6/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Hash#rekey"
> on Mon, 5 Feb 2007 07:34:49 +0900, "Trans" <transfire@gmail.com> writes:
>
> |I used 'normalize_keys' for while, but how doesn't 'rekey' fit the
> |behavior? The hash is being rekey'd.
>
> For me, 'rekey' is meaningless. Coined word need guessing, which is
> considered harmful unless it is accepted by many.

alter_key(s), perhaps

martin

Brian Candler

2/6/2007 12:50:00 PM

0

On Tue, Feb 06, 2007 at 09:34:02PM +0900, Martin DeMello wrote:
> On 2/6/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> >Hi,
> >
> >In message "Re: Hash#rekey"
> > on Mon, 5 Feb 2007 07:34:49 +0900, "Trans" <transfire@gmail.com>
> > writes:
> >
> >|I used 'normalize_keys' for while, but how doesn't 'rekey' fit the
> >|behavior? The hash is being rekey'd.
> >
> >For me, 'rekey' is meaningless. Coined word need guessing, which is
> >considered harmful unless it is accepted by many.
>
> alter_key(s), perhaps

# existing
a = [:one, :two, :three]
a.map! { |k| k.to_s }
puts a.inspect

# by analogy
h = [:one=>1, :two=>2, :three=>3]
h.map_keys! { |k| k.to_s }
puts h.inspect

Trans

2/6/2007 1:10:00 PM

0



On Feb 6, 2:35 am, Yukihiro Matsumoto <m...@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Hash#rekey"
> on Mon, 5 Feb 2007 07:34:49 +0900, "Trans" <transf...@gmail.com> writes:
>
> |I used 'normalize_keys' for while, but how doesn't 'rekey' fit the
> |behavior? The hash is being rekey'd.
>
> For me, 'rekey' is meaningless. Coined word need guessing, which is
> considered harmful unless it is accepted by many.

The use of re- as a prefix is very normal in English. Consider Merriam-
Webster's list

http://www.m-w.com/dict...

I certainly didn't coin the word. Common connotations include: re-
entering data via keyboard as well as altering a combination of a
lock. So, for altering the keys of a hash it makes prefect sense.

Anyway I won't go on about it any longer. Personally I'm just not
found of having to type longer winded method name.

T.