On Aug 19, 2010, at 3:09 42PM, Göran Krampe wrote:

> On 08/19/2010 02:03 PM, Henrik Johansen wrote:
>> What would you say the right thing is?
> 
> Well, intuitively I would say that converting an Array of Character instances 
> (say 5 instances) using "asString" would give me a String of size 5. Also, 
> "Character space asString" does NOT give me 'Character space' but actually ' 
> '.
Maybe its just me, but I'd rather not have
SequenceableCollection >> asString mean "If I contain only elements which may 
represent characters, return a string containing those, if not, return my 
printString"

> 
> Having a fallback on printString is of course fine, in Object. But... well, I 
> haven't thought *deeply* on this, but a sequencable collection of Characters 
> should IMHO be able to produce a String
> regards, Göran

And it is, using either 
collection as: String, or 
String withAll: collection
In both cases you then explicitly specify that this collection will contain 
only elements which can be converted to a string, rather than have a later 
reader of the code have to question "hmmm, does the use of asString here mean 
he'll be using the collections printString, or the string with its elements?"

Cheers,
Henry
_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to