On 2/8/07, O Rapouso <[EMAIL PROTECTED]> wrote:
>
>
> Reading the API, i saw that whenever you add a key to a Hash, that has
> the same name of a already existing property in its prototype, that
> property is lost to the new value, obviously. You can see that happen
> in the API's example.


Your implementation suffers from the same defect. It is only "safe" on
initialization.

Once I wrote a safe hash implementation (see the first patch):
http://dev.rubyonrails.org/ticket/6649

It is safe as long as you don't set keys on it (after initialization)
directly - you can see it suffers from the same thing as yours. BUT, my
implementation allows subsequent key reading/writing via the get/set
methods. Also, my implementation is somewhat simpler.

I've attached the full patched hash.js to this message.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: safe-hash.js
Description: JavaScript source

Reply via email to