|Anonymous | Login||07-05-2020 17:10 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0007095||[Squeak] Collections||major||always||06-13-08 07:27||04-18-10 22:05|
|Summary||0007095: Dictionary>>collect: answers OrderedCollection not Dictionary|
|Description||Which is clearly wrong. Attached change set fixes it and also provides tests to cover the behavior of #select:, #reject: and #collect:.|
Here is what ANSI says:
188.8.131.52 Message Refinement: collect: transformer
Answer a new collection constructed by gathering the results of evaluating transformer with each element of the receiver.
For each element of the receiver, transformer is evaluated with the element as the parameter. The results of these evaluations are collected into a new collection. The elements are traversed in the order specified by the #do: message for the receiver. Unless specifically refined, this message is defined to answer an object conforming to the same protocol as the receiver.
Answer a new instance of the receiver's type with the same keys. For each key of the answer, a new element is obtained by evaluating transformer with the corresponding element of the receiver as the parameter.
|Attached Files||DictCollect-ar.cs [^] (2,799 bytes) 06-13-08 07:27|
(0012329 - 90 - 150 - 150 - 150 - 150 - 150)
edited on: 02-15-09 06:25
Installer mantis bug: 7095 fix: 'DictCollect-ar.cs'.
(0012330 - 779 - 855 - 855 - 855 - 855 - 855)
I support this request as the most logical of the month.
Two good reasons to not answer an OrderedCollection are:
1) Dictionary behaves more like Bag than OrderedCollection because Dictionary values are Unordered (order is arbitrary and can change at any time if Dictionary happens to grow).
2) Answering an OrderedCollection is an operation
- replacing user assigned crafted keys
- with totally arbitrarily assigned keys (from: 1 to: self size)
Some discussion on squeak-dev incorrectly stated that Dictionary should return anOrderedCollection because a collection of values is expected...
But wait, what a Dictionary is? Just a Bag of values with user assigned keys!
So answering a Dictionary is the clever thing to do, that's not only an opinion, that's facts.
(0012860 - 38 - 38 - 38 - 38 - 38 - 38)
|I suspect that this might break things|
(0013322 - 126 - 138 - 466 - 466 - 466 - 466)
|06-13-08 07:27||andreas||New Issue|
|06-13-08 07:27||andreas||File Added: DictCollect-ar.cs|
|07-03-08 20:42||nicolas cellier||Note Added: 0012329|
|07-03-08 20:52||nicolas cellier||Note Added: 0012330|
|08-29-08 21:13||Keith_Hodges||Note Added: 0012545|
|12-17-08 04:39||Keith_Hodges||Note Deleted: 0012545|
|12-17-08 04:40||Keith_Hodges||Note Added: 0012860|
|12-17-08 04:41||Keith_Hodges||Status||new => acknowledged|
|01-10-09 02:13||Keith_Hodges||Status||acknowledged => pending|
|01-10-09 02:27||Keith_Hodges||Status||pending => testing|
|01-10-09 03:40||Keith_Hodges||Status||testing => resolved|
|01-10-09 03:40||Keith_Hodges||Fixed in Version||=> 3.11|
|01-10-09 03:40||Keith_Hodges||Resolution||open => fixed|
|01-10-09 03:40||Keith_Hodges||Assigned To||=> Keith_Hodges|
|01-10-09 03:41||Keith_Hodges||Status||resolved => testing|
|02-15-09 06:25||andreas||Note Edited: 0012329|
|09-25-09 20:39||nicolas cellier||Note Added: 0013322|
|10-03-09 19:33||Keith_Hodges||Status||testing => assigned|
|10-03-09 19:33||Keith_Hodges||Assigned To||Keith_Hodges => andreas|
|10-03-09 20:14||nicolas cellier||Status||assigned => resolved|
|10-03-09 20:14||nicolas cellier||Fixed in Version||3.11 => trunk|
|04-18-10 22:05||andreas||Status||resolved => closed|
| Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
69 total queries executed.|
39 unique queries executed.