Fixing behavior of Array.flat when it contains strings


Sending the message flat to an Array that contains strings, results in the Strings being decomposed to their characters. For example:

["hello", [1, 2, "there"]].flat;


[ h, e, l, l, o, 1, 2, t, h, e, r, e ]

In my view, this is not the intended behavior, because a String is usually treate as a single object, not an array. I would expect the above to return this instead:

 [ "hello", 1, 2, "there" ]

The fix for this is to add the following method to String:

prFlat { | list |
	^list add: this

I committed a pull request for this. Hopefully my thought is correct, but if not, please explain the current behavior of flat in the case of arrays containing Strings.

Iannis Zannos