On Sep 11, 4:39 pm, kangax <kan...@gmail.com> wrote:
> On Sep 11, 7:08 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> [...]
>
> > @Jim:
>
> > > Yep, this is Java-esque but that doesn't *always* equal evil!
>
> > Hardly ever!  I'd say hashCode has a place.
>
> > Let's step back and ask the question:  What are the use cases for a
> > hash keyed by non-string objects?  Are they compelling?  (I'm not
> > saying they aren't, just saying that before running off on an idea, we
> > need to ask the question.)
>
> I would actually like to hear about use cases too. Developing web apps
> for 3 years now I haven't ever needed to use hash with arbitrary keys.
> It doesn't mean such thing is not useful; I'm just failing to see how
> (and where) it can be applied in practice (especially in a context of
> web apps).


For what it's worth, my use case for developing the jshashtable
(mentioned elsewhere on this thread) was in a fairly involved WYSIWYG
editor (around 15,000 lines of code): I wanted to associate objects
within quite a complicated model. I started using it for caching the
results of operations on certain model objects and have ended up using
it several places where a simple object would do, just for the
convenience of the API. I have never used it with DOM elements as keys
for the very reasons mentioned in this thread to do with keeping
references to DOM nodes hanging around, though you'd be ok if you made
sure you called clear() on one of my hash tables once you're finished
with it.

Tim

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to