pharo
pharo copied to clipboard
Deprecate `Object >> #split:`?
The method Object >> #split is understood by all objects. The method's comment says
Split the argument using the receiver as a separator. Optimized version for single delimiters
The question is, does it make sense to have that method in Object? For example, if we do
SpPresenter new split: 'hello'` "'hello'"
It will return 'hello' which, for me, it does not make sense.
We could move the code (switching receiver and argument) and have a #splitUsing: in SequenceableCollection,
'Hello' splitUsing: $l
We can use it in Object>>split: but deprecate this one.
split: aSequenceableCollection
^ aSequenceableCollection splitUsing: self
Yes, we can have a splitUsing:. But, we will need to refactor SequenceableCollection>>#splitOn: to that does the same thing but inversely.
For Object >> #split: I'd say to remove it. Because the method is not clear. It should not be understood by all objects. The SpPresenter is a good example. Why a presenter understand split:
Remove yes - but as there might be users we should deprecate it for at least one iteration. As usual.
Yes, I meant to deprecate it to remove it in the next Pharo version