« Bugzilla Issues Index
#3150 — Array.p.sort needs to take impure ToString operator into account
- bug_id:
3150
- creation_ts:
2014-08-25 06:56:00 -0700
- short_desc:
Array.p.sort needs to take impure ToString operator into account
- delta_ts:
2015-10-04 09:01:12 -0700
- product:
ECMA-262, Editions 5 and 5.1
- component:
technical content
- version:
Edition 5.1
- rep_platform:
All
- op_sys:
All
- bug_status:
RESOLVED
- resolution:
FIXED
- priority:
Normal
- bug_severity:
enhancement
- everconfirmed:
true
- reporter:
Andreas Rossberg
- assigned_to:
Allen Wirfs-Brock
- cc:
brterlso
- commentid:
9864
- comment_count:
0
- who:
Andreas Rossberg
- bug_when:
2014-08-25 06:56:58 -0700
(This also applies to the ES6 draft.)
The second condition defining when the characteristics of a sort result does not make sense in general. SortCompare invokes ToString, which could be arbitrarily impure. In particular, it might return arbitrary different results on each call.
There probably needs to be language making the result of sort implementation-dependent when the ToString for any of the array elements is not a constant function.
- commentid:
12800
- comment_count:
1
- who:
Allen Wirfs-Brock
- bug_when:
2015-02-16 18:47:30 -0800
added conditions to ES6 rev34 draft
- commentid:
14774
- comment_count:
2
- who:
Brian Terlson
- bug_when:
2015-10-04 09:01:12 -0700
Fixed in ES2015.