Hi James, You're right, Hash does indeed rely on underlying JavaScript vanilla objects, which can only use strings as keys.
Supporting using objects as keys would be a complete rewrite, and a fairly inefficient one in terms of runtime performance (I did it once, and abandoned it as not worthwhile). I'm not aware of any plans to do so. I suspect you'd be better off (from a performance standpoint) building toString / fromString support into your keys. FWIW, -- T.J. Crowder tj / crowder software / com www.crowdersoftware.com On Sep 10, 7:07 pm, James Aimonetti <james.aimone...@gmail.com> wrote: > Core, > > Wanted to ask about why Hash doesn't support Objects as keys? I believe > it relies on Javascript using the toString on the object to set the > key's value, rather than a true hash. > > var key1 = new Object(); > var key2 = new Object(); > var h = $H(); > h.set(key1, "First"); > h.set(key2, "Second"); > h.get(key1) // -> Second > > Is there any plan to support true object-as-key ability? I couldn't find > discussion on the topic searching the group. > > -- > James Aimonetti > mobile: 314.809.6307 > work: 540.459.2220 > email: james.aimone...@gmail.com > website:http://jamesaimonetti.com --~--~---------~--~----~------------~-------~--~----~ 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 prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---