Anonymous | Login | 01-15-2021 18:52 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 | ||||
0007269 | [Squeak] Collections | minor | always | 01-13-09 23:31 | 04-18-10 22:05 | ||||
Reporter | Keith_Hodges | View Status | public | ||||||
Assigned To | nicolas cellier | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | |||||||
Summary | 0007269: OrderedCollection streamContents broken | ||||||||
Description |
OrderedCollection streamContents: [ :str | 200 timesRepeat: [ str nextPut: 1 ] ] fails |
||||||||
Additional Information | |||||||||
Attached Files |
![]() ![]() |
||||||||
|
![]() |
||||||
|
![]() |
|
(0012924 - 1266 - 1724 - 1724 - 1724 - 1724 - 1724) wiz 01-16-09 03:45 |
The culprit IMO is this: (From 3.10.2) 'md 2/24/2006 19:50 WriteStream pastEndPut: {private}' WriteStream>>pastEndPut: anObject "Grow the collection by creating a new bigger collection and then copy over the contents from the old one. We grow by doubling the size but the growth is kept between 20 and 1000000. Finally we put <anObject> at the current write position." | oldSize grownCollection | oldSize := collection size. grownCollection := collection class new: oldSize + ((oldSize max: 20) min: 1000000). collection := grownCollection replaceFrom: 1 to: oldSize with: collection startingAt: 1. writeLimit := collection size. collection at: (position := position + 1) put: anObject. "return the argument - added by kwl" ^ anObject Obviously wired to assume an arrayed collection. And it is assuming the responsibility of making a grown collection. There needs to be language that lets the collection return a grown form of itself. WriteStream should be collection agnostic. Either that or streamContents should be defined at the ArrayedCollection level and not the Sequential Collection level. Of course that would not still allow streaming contents on an ordered collection. But at least it wouldn't raise false hopes. |
(0012988 - 1219 - 1643 - 1643 - 1751 - 1751 - 1751) nicolas cellier 02-24-09 11:21 |
jerome, you mean delegate the grow operation to collection by sending a message like other st dialects do ? collection := collection grownToSize: oldSize + ((oldSize max: 20) min: 1000000). Good news, the message both: - already exists - will work with OrderedCollection (after applying 0007296 patch) You can either use #ofSize: and do the copy yourself Or use #forceTo:padding: which does the copy for you. Unfortunately which padding element to use is not obvious: (collection species ofSize: 1) anyOne is a good padding, but kind of overkill... WriteStream>>pastEndPut: anObject "Grow the collection by creating a new bigger collection and then copy over the contents from the old one. We grow by doubling the size but the growth is kept between 20 and 1000000. Finally we put <anObject> at the current write position." | oldSize defaultElement | oldSize := collection size. defaultElement := (collection species ofSize: 1) anyOne. collection := collection forceTo: oldSize + ((oldSize max: 20) min: 1000000) paddingWith: defaultElement. writeLimit := collection size. collection at: (position := position + 1) put: anObject. ^ anObject |
(0012991 - 376 - 457 - 457 - 457 - 457 - 457) wiz 02-26-09 02:50 |
Hi nicolas, Thanks for chiming in. > jerome, you mean delegate the grow operation to collection by sending a message like other st dialects do ? That's what I had in mind. I don't know other dialects. What do they send? Are they in agreement? I have not thought beyond my first comment on this. If you can think this thru to a solution that would be great. |
(0012992 - 240 - 300 - 300 - 300 - 300 - 300) nicolas cellier 02-26-09 10:40 |
"fix begin" Installer mantis ensureFix: 7296. Installer mantis bug: 7269 fix: 'M7269-OrderedCollection-streaming-nice-patch.1.cs'. "fix test" Installer mantis bug: 7269 fix: 'M7269-OrderedCollection-streaming-nice-test.1.cs'. "fix end" |
(0013270 - 64 - 64 - 224 - 224 - 224 - 224) nicolas cellier 08-24-09 20:08 |
Fixed in http://source.squeak.org/trunk/Collections-nice.116.mcz [^] |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
65 total queries executed. 44 unique queries executed. |