It's extension of the Array object if perfectly fine, if people would just stop using the Array object as an associative array (just use a normal object for that)... Arrays are for numeric indexing and should NOT be used as dictionaries or hash tables. Using Array in that manner is entirely useless as it completely circumvents the Array object's built in behaviors for pushing, popping, indexing, etc... (again, just use an Object if you're looking for an associative array)

So instead of

var wrongArrayUsage = new Array();
wrongArrayUsage["someKey"] = "foo";
for (var p in wrongArrayUsage)
{
alert(wrongArrayUsage[p]);
}

Use...

var correctArrayUsage = new Array();
correctArrayUsage.push("foo");
for (i = 0; i < correctArrayUsage.length; i++)
{
alert(correctArrayUsage[i]);
}

Or...

var associativeArrayObj = new Object();
associativeArrayObj["someKey"] = "foo";
for (var p in associativeArryObj)
{
alert(associativeArrayObj[p]);
}


If the Dojo library uses Array incorrectly, causing this error (which I'm not sure on way or the other as I don't use Dojo), then the problem lies with Dojo, not with Prototype (at least for 1.5.x and later)...

On 6/7/06, John Wang <[EMAIL PROTECTED]> wrote:
I heard that, as of 1.5.x, prototype is no longer extending object prototypes or causing object bleeding, making it more compatible with 3rd-party _javascript_s such as Dojo Toolkit. I tested this by running prototype 1.5.0 rc0 and Dojo 0.3.0 together and Firefox's _javascript_ Console produced the following error:

  Error:
    mll[x] is not a function
    http://foo.bar/dojo/dojo.js    Line: 212

It seems like prototype is still extending the Array object prototype. Is this a known issue? Are there any plans to fix this?

Thanks,
John

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to