PDA

View Full Version : Extending array object in yui-adapter breaks my code



dngrmoose
26 Feb 2007, 8:12 PM
The new Ext stuff is great, but the addition of the ext-yui-adapter.js now breaks my code. I use "associative arrays" all over the place (e.g. for in loops) and now I am getting issues looping over keys in an object -- remove and indexOf are now keys!

I'll code around it -- own hashtable implementation or typeof checks, but just letting everyone know that is also a change that my affect people.

brian.moeskau
26 Feb 2007, 8:29 PM
Unrelated to your issue, but have you checked out the MixedCollection class in Ext? It's a pretty powerful array wrapper that also supports hashtable functionality. Might be easier than rolling your own.

jack.slocum
27 Feb 2007, 8:20 AM
I resisted adding these for a long time because of that reason.

On a side note, for associative arrays you should use {} instead of []. There has been alot of religious debate over this, but in general there is no reason (only additional overhead) of using an array for key'ed values instead of an object.

dngrmoose
27 Feb 2007, 1:36 PM
On a side note, for associative arrays you should use {} instead of []. There has been alot of religious debate over this, but in general there is no reason (only additional overhead) of using an array for key'ed values instead of an object.

Ahh yes, but I was being lazy and dynamically adding keys to an object for indexing purposes. It's ok, I can code around it.