On 29 January 2010 11:58, commits@source.squeak.org wrote:
Edgar J. De Cleene uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-edc.285.mcz
==================== 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!
Edgar, 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).
So, you should move that method down the hierarchy, which is SequenceableCollection.. 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.
On 1/29/10 8:44 AM, "Igor Stasenko" siguctua@gmail.com wrote:
ends with..' is not applicable to it.
I have endsWithAnyOf: aCollection aCollection do:[:suffix| (self endsWith: suffix) ifTrue:[^true]. ]. ^false
It's of Yoshiki of 2004
So he is right and me wrong?
Edgar
On 1/29/10 8:44 AM, "Igor Stasenko" siguctua@gmail.com wrote:
Edgar, things begin with _prefix_ but end with _suffix_
Ok I see
Must change suffix for prefix. But still insist the method is useful, at least to me
On 1/29/10 8:44 AM, "Igor Stasenko" siguctua@gmail.com wrote:
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.
As said before, the image lack this simmetry and I correct it doing a mistake :)
Edgar
On 29 January 2010 12:44, Igor Stasenko siguctua@gmail.com wrote:
On 29 January 2010 11:58, commits@source.squeak.org wrote:
Edgar J. De Cleene uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-edc.285.mcz
==================== 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!
Edgar, 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 SequenceableCollection.. 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.
On 1/29/10 8:48 AM, "Igor Stasenko" siguctua@gmail.com wrote:
I send it again, this time with correct word and to inbox. Sorry.
Igor could use this in another as String? Like see...
Edgar
On 29 January 2010 12:08, Edgar J. De Cleene edgardec2001@yahoo.com.ar wrote:
On 1/29/10 8:48 AM, "Igor Stasenko" siguctua@gmail.com wrote:
I send it again, this time with correct word and to inbox. Sorry.
Igor could use this in another as String? Like see...
If you ask me, I hardly see a need in such methods at all.
Edgar
squeak-dev@lists.squeakfoundation.org