|
Re: [FIX] SortedCollectionFix-sr: msg#00676lang.smalltalk.squeak.general
- >>addLast: should be forbidden as >>addFirst is already; Why should addLast: or addFirst: be given a complete veto? Why not addFirst: anItem self isEmpty ifTrue: [^super addFirst: anItem]. (sortBlock ifNil: [anItem <= self first] ifNotNil: [sortBlock value: anItem value: self first] ) ifFalse: [ self error: 'new item would be out of order' ]. ^super addFirst: anItem. addLast: anItem self isEmpty ifTrue: [^super addLast: anItem]. (sortBlock ifNil: [self last <= anItem] ifNotNil: [sortBlock value: self last value: anItem] ) ifFalse: [ self error: 'new item would be out of order' ]. ^super addLast: anItem. This way we DON'T have to invent a new method to use when someone wants to build up a SortedCollection one element at a time and knows they can do it in the correct order, and we still don't allow these methods to spoil the order of the collection.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: An example..., Lic. Edgar J. De Cleene |
|---|---|
| Next by Date: | Re: Yahoo archive truncated, ajbn |
| Previous by Thread: | [FIX] SortedCollectionFix-sr, Stephan Rudlof |
| Next by Thread: | Re: [FIX] SortedCollectionFix-sr, Stephan Rudlof |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |