On Fri, 15 May 2020 at 20:43, Richard O'Keefe <raoknz@gmail.com> wrote:
Why does it make no sense? To a first approximation, aCollection asWHATEVER = WHATEVER withAll: aCollection
Consider 'CAB' asSet 'CAB' asArray 'CAB' asSortedCollection 'CAB' asBag and so on. They all mean "an instance of the class named in the selector with the elements of the receiver." Why should #asString be any different?
Good point. There may be counter arguments (I've only considered this briefly) but where possible it seems reasonable that the asXXXX selectors should be able to round-trip. i.e... 'abc' asByteArray asString ==> 'abc' in which case... 'abc' asArray asString ==> '#($a $b $c) seems wrong. That result seems more suitable to #printString or #displayString, particularly considering Richards next insight...
Why on earth does #($a $b $c) asString make no sense when #($a $b $c) as: String -- which we expect to do the same thing -- DOES apparently make sense?
cheers -ben