Opened 16 years ago

Closed 16 years ago

#359 closed defect (fixed)

dojo.lang.find problems with polymorphism and arrays

Reported by: skinner Owned by: skinner
Priority: lowest Milestone:
Component: Core Version: 0.2
Keywords: Cc: [email protected]
Blocked By: Blocking:


Okay, so this maybe isn't even really bug, or isn't worth reporting. But I wanted to at least mention it, to raise the question of whether dojo.lang.find should really be trying to be polymorphic at all.

In this example, the last assert fails:

var foo = new Array(128, 256);

foo.push("iggy"); jum.assertTrue("1", dojo.lang.find("iggy", foo) == 2); jum.assertTrue("2", dojo.lang.find(foo, "iggy") == 2);

var iggy = new Array("aaa", "bbb", "ccc"); foo.push(iggy); jum.assertTrue("3", dojo.lang.find(foo, iggy) == 3); jum.assertTrue("4", dojo.lang.find(iggy, foo) == 3);

Change History (6)

comment:1 Changed 16 years ago by david

Good point. I'd be afraid of changing find at this juncture as it has potential to break almost everyone. We should probably just recommend doing find(arr, val) from here on out.

comment:2 Changed 16 years ago by Tom Trenka

Brian, can we close this in favor of #348?

comment:3 Changed 16 years ago by skinner

Hi Tom,

Actually, I think #348 was fixed months ago and should have been marked as closed/fixed.

As for #359, my vote would be to (a) document dojo.lang.find as accepting only the (arr, val) signature, and (b) continue for now to allow calls with the (val, arr) signature but include a dojo.deprecated warning, and remove that signature in the future.

comment:4 Changed 16 years ago by Tom Trenka

Ok, feel free to do that (I'm in agreement with you about the signature but I'd be in favor of simply pulling the (val, arr) signature without the deprecated call).

comment:5 Changed 16 years ago by skinner

Owner: changed from anonymous to skinner

comment:6 Changed 16 years ago by skinner

Resolution: fixed
Status: newclosed

fixed in rev 4681

Note: See TracTickets for help on using tickets.