[Pharo-project] String mathematical operations

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Sep 6 08:16:02 EDT 2011


+1

2011/9/6 Igor Stasenko <siguctua at gmail.com>:
> personally, i prefer a strict-typing behavior when using arithmetics.
> for that reason, i prefer seeing error in
>
> someString + 4
> or
> 4 + someString
>
> but not automagical conversion.
>
> On 6 September 2011 13:57, Camillo Bruni <camillo.bruni at inria.fr> wrote:
>> We still have a lot of awkward methods on String for doing math:
>>
>>        String >> #* arg
>>                ^ arg adaptToString: self andSend: #*
>>
>> Who is relying on them? I would like to deprecate them all :D
>> I guess some binary math selectors might make sense
>>
>>        String >> #* count
>>                ^ self class new: self size * count streamContents: [ :stream|
>>                        count timesRepeat: [ stream << self ]].
>>
>> cami
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>




More information about the Pharo-dev mailing list