Thanks for the fast response. But the issue here is that the existing
app is very big and complicate. Modifying all the array's to objects
and testing all the functionalities is going to kill our time. Believe
me, if I am going to propose this solution, first thing that will come
up is that they will not allow our module to use prototype.

Having said this, is it possible to do something within my module?

Thanks,
Muthu.

On Mar 27, 3:50 pm, "Ryan Gahl" <[EMAIL PROTECTED]> wrote:
> Yes, and the thing you need to do to avoid this is not use for..in loops
> with an Array. Using Array that way is wrong (sorry to be so blunt, not
> trying to be rude). If you're doing for..in, use an Object. Objects are
> after all associative arrays in reality. Iterating Array objects using
> for..in is basically wasting an Array. You're using the fact that it is also
> an Object, but are not using the special features of Array. You should
> really be .push()'ing objects into your array (not setting them via
> myArray["someKey"] = foo)... and iterating them using the numeric indexing
> (or prototype's .each() if you want to have true block level scoping for
> each iteration pass)
>
> To summarize: don't use for..in to iterate and Array instance. Period.
> That's the answer. Bar none. It's basically the root of all evil... not
> gonna lie.
>
> :)
>
> On 3/27/08, Muthu <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a small module that I am developing using Prototype. I have
> > javascript Array's declared in my existing app and the we access the
> > elements using for...in - for(x in myArray...).
>
> > When I include my new module with Prototype to my existing app, all
> > the for..in statements for the Array are getting the functions from
> > the prototype.js as elements in it. Is there something I need to do to
> > avoid this?
>
> > Thanks,
> > Muthiah.
>
> --
> Ryan Gahl
> Manager, Senior Software Engineer
> Nth Penguin, LLChttp://www.nthpenguin.com
> --
> WebWidgetry.com / MashupStudio.com
> Future Home of the World's First Complete Web Platform
> --
> Inquire: 1-920-574-2218
> Blog:http://www.someElement.com
> LinkedIn Profile:http://www.linkedin.com/in/ryangahl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to