[Pharo-project] String mathematical operations
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
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@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.
+1 2011/9/6 Igor Stasenko <siguctua@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@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.
⦠and deprecated it is :P On 2011-09-06, at 14:16, Nicolas Cellier wrote:
+1
2011/9/6 Igor Stasenko <siguctua@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@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.
+ 1 ----- Original Message ----- From: "Nicolas Cellier" <nicolas.cellier.aka.nice@gmail.com> To: <Pharo-project@lists.gforge.inria.fr> Sent: Tuesday, September 06, 2011 2:16 PM Subject: Re: [Pharo-project] String mathematical operations +1 2011/9/6 Igor Stasenko <siguctua@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@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.
+ '1' ;-) On Tue, Sep 6, 2011 at 4:18 PM, Lorenzo Schiavina <lorenzo@edor.it> wrote:
+ 1 ----- Original Message ----- From: "Nicolas Cellier" < nicolas.cellier.aka.nice@**gmail.com <nicolas.cellier.aka.nice@gmail.com>> To: <Pharo-project@lists.gforge.**inria.fr<Pharo-project@lists.gforge.inria.fr>
Sent: Tuesday, September 06, 2011 2:16 PM Subject: Re: [Pharo-project] String mathematical operations
+1
2011/9/6 Igor Stasenko <siguctua@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@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.
-- Cheers, Peter
On 6 September 2011 12:57, Camillo Bruni <camillo.bruni@inria.fr> wrote:
We still have a lot of awkward methods on String for doing math:
    String >> #* arg         ^ arg adaptToString: self andSend: #*
+1 for killing that.
Who is relying on them?
E-Toys was using that.
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 ]].
+1 Lukas -- Lukas Renggli www.lukas-renggli.ch
participants (7)
-
Camillo Bruni -
Igor Stasenko -
Lorenzo Schiavina -
Lukas Renggli -
Nicolas Cellier -
Peter Hugosson-Miller -
Philippe Marschall