[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Hash insertion order preservation in ruby1.9

Yukihiro Matsumoto

3/31/2008 9:19:00 PM

Hi,

In message "Re: Hash insertion order preservation in ruby1.9"
on Mon, 31 Mar 2008 19:55:12 +0900, Joachim (M=FCnchen) <wuttke1@web.de=
> writes:

|I am glad to see that ruby1.9.0 preserves hash insertion order.
|It will finally allow me to generate human-readable yaml dumps
|without ugly workarounds.
|
|Some questions:
|
|(1) Can I rely upon hash insertion order preservation as an approved
|new feature of Ruby, without any risk that it may get lost again in
|future releases ?

For CRuby, yes. For Ruby the language, we have to make up consensus
with other implementations.

matz.

2 Answers

MenTaLguY

3/31/2008 9:30:00 PM

0

On Tue, 1 Apr 2008 06:18:51 +0900, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> |(1) Can I rely upon hash insertion order preservation as an approved
> |new feature of Ruby, without any risk that it may get lost again in
> |future releases ?
>
> For CRuby, yes. For Ruby the language, we have to make up consensus
> with other implementations.

I think it is safe to say it will remain in JRuby as well. The new
behavior has allowed us to optimize hash iteration since it is now
entirely deterministic.

-mental


Evan David Light

3/31/2008 9:50:00 PM

0

Cool! I've seen folks trip themselves up on this using 1.8.6 before
because of an assumption in their mental model of the language. Nice
to see this addressed.

Sent from my iPhone

On Mar 31, 2008, at 5:30 PM, MenTaLguY <mental@rydia.net> wrote:

> On Tue, 1 Apr 2008 06:18:51 +0900, Yukihiro Matsumoto <matz@ruby-lang.org
> > wrote:
>> |(1) Can I rely upon hash insertion order preservation as an approved
>> |new feature of Ruby, without any risk that it may get lost again in
>> |future releases ?
>>
>> For CRuby, yes. For Ruby the language, we have to make up consensus
>> with other implementations.
>
> I think it is safe to say it will remain in JRuby as well. The new
> behavior has allowed us to optimize hash iteration since it is now
> entirely deterministic.
>
> -mental
>
>