join

Andreas Raab andreas.raab at gmx.de
Fri Sep 15 19:29:29 UTC 2006


 > Is anyone convinced?

I'm sure someone is convinced but probably not everyone ;-) Couple of notes:

> For this reason I think that split: should depend on VB-Regex, unless 
> someone want's to implement one of the modern algoirthms
> 
> I propose that: String>>split: ^ regexString asRegex split: self

I don't like this too much as it means there is special meaning to the 
search pattern (wildcards and the like) and it requires a non-optional 
dependency on a regex package. Perhaps the simple string split should 
remain the simple string split and the regex string split should remain 
in regex?

> On join:
> - join: is the conceptual inverse of split: (see the tests in 
> http://squeaksource.com/RubyShards/)
> - join: obviously works for Sequenceables as well as Strings
> 
> I propose adding the following method to either SequenceableCollection 
> or OrderedCollection [the tradeoff is not clear to me].

OrderedCollection makes little sense since you couldn't join: arrays or 
strings in that case so it should go into SequenceableCollection.

> join: anOrderedCollection

It would be good to give this a role instead of a type name. From the 
type name it's not immediately obvious whether:
   'abc' join: 'xyz'
results in 'axyzbxyzc' or 'xabcyabcz'.

>     "Implicit precondition: my elements are all OrderedCollections"

The precondition should probably be that "receiver species = argument 
species" and consequently determine the result species.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list