[Pharo-project] About String empty and others

Stéphane Ducasse stephane.ducasse at inria.fr
Sat Feb 13 14:01:44 EST 2010


On Feb 13, 2010, at 7:40 PM, Michael Roberts wrote:

> would the idea to be to rewrite every #() with Array empty?

no and this is a good question.
For now I do not see what we learn. I'm not sure that these empty messages bring anything.
besides one extra message.

> If that was the case could you get the compiler to do that as an
> optimization? I quite like the fact that #() is the empty array. it's
> nice and compact; quite aesthetic.

yes I will roll back some of the changes

> 
> cheers,
> Mike
> 
> On Sat, Feb 13, 2010 at 11:06 AM, Stéphane Ducasse
> <stephane.ducasse at inria.fr> wrote:
>> Hi guys
>> 
>> chris mueller proposed in squeak to have
>> 
>> 
>> Exception>>messageText
>>       "Return an exception's message text."
>> +       ^ messageText ifNil: [ String empty ]!
>> -
>> -       ^messageText!
>> 
>> - Added Array class>>#empty and String class>>#empty to provide applications with
>> canonicalized instances of these oft-used objects; since they are embedded as literals in the
>> CompiledMethod.
>> 
>> =============== Diff against Collections-ar.304 ===============
>> 
>> Item was added:
>> + ----- Method: Array class>>empty (in category 'instance creation') -----
>> + empty
>> +       "A canonicalized empty Array instance."
>> +       ^ #()!
>> 
>> Item was added:
>> + ----- Method: String class>>empty (in category 'instance creation') -----
>> + empty
>> +       "A canonicalized empty String instance."
>> +       ^ ''!
>> 
>> Item was removed:
>> - ----- Method: String>>asDefaultDecodedString (in category 'converting') -----
>> - asDefaultDecodedString
>> -
>> -       ^ self
>> 
>> 
>> http://code.google.com/p/pharo/issues/detail?id=1961
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>> 
> 
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project





More information about the Pharo-dev mailing list