[squeak-dev] The Trunk: Collections-edc.285.mcz
siguctua at gmail.com
Fri Jan 29 10:48:30 UTC 2010
On 29 January 2010 12:44, Igor Stasenko <siguctua at gmail.com> wrote:
> On 29 January 2010 11:58, <commits at source.squeak.org> wrote:
>> Edgar J. De Cleene uploaded a new version of Collections to project The Trunk:
>> ==================== Summary ====================
>> Name: Collections-edc.285
>> Author: edc
>> Time: 29 January 2010, 7:01:04.567 am
>> UUID: b62a5e69-31ed-4958-b317-621a163b5a90
>> Ancestors: Collections-ul.284
>> -enh Add String > beginsWithAnyOf:
>> =============== Diff against Collections-ul.284 ===============
>> Item was added:
>> + ----- Method: String>>beginsWithAnyOf: (in category 'comparing') -----
>> + beginsWithAnyOf: aCollection
>> + aCollection do:[:suffix|
>> + (self beginsWith: suffix) ifTrue:[^true].
>> + ].
>> + ^false!
> things begin with _prefix_
> but end with _suffix_
> Also, putting that into Collection protocol is wrong place, because
> base Collection class does not
> specifying any order over its elements. And therefore any terms like
> 'begins with..' or 'ends with..' is not applicable to it.
> (for example Set can't implement this method reliably).
Oops sorry.. i mistakenly thought that you put it into Collection. But
it is in String.
Still, i think that SequenceableCollection is better place for it.
> So, you should move that method down the hierarchy, which is
> Also, if you want to extend a protocol in such way, you should care
> about symmetry,
> since you adding new #beginsXXX method, it is logical to also have
> symmetric #endsXXX with analoguous behavior.
> Best regards,
> Igor Stasenko AKA sig.
Igor Stasenko AKA sig.
More information about the Squeak-dev