may be there is a better solution.. Nicolas??
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project digits.2.cs (362 bytes) Download Attachment |
Just two remarks from a non native english guy:
1) "digit" is also used with different semantic in #digitLength #digitAt: #digitAt:put: and thus a method comment is more than welcome! 2) there is already a SmallInteger>>#decimalDigitLength doing what you want. However, since SmallInteger>>#numberOfDigitsInBase: is sending #decimalDigitLength , implementing : Integer>>#decimalDigitLength ^self numberOfDigitsInBase: 10 is possible but a little troubling (inverted send logic in superclass and subclass). Also, you'd better not remove SmallInteger>>#decimalDigitLength because avoiding quo: it is very efficient for most common cases. So maybe adding a third message numberOfDigits is the best way... I let you judge by yourself. (Bad luck, I just come back from Greece, and if you ask an oracle, answer is rarely yes or no). Nicolas 2009/4/12 Stéphane Ducasse <[hidden email]>: > may be there is a better solution.. Nicolas?? > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
:)
decimalDigitLength looks like an obscure name. Stef On Apr 12, 2009, at 5:32 PM, Nicolas Cellier wrote: > Just two remarks from a non native english guy: > > 1) "digit" is also used with different semantic in #digitLength > #digitAt: #digitAt:put: > and thus a method comment is more than welcome! yeap! > > > 2) there is already a SmallInteger>>#decimalDigitLength doing what > you want. > However, since SmallInteger>>#numberOfDigitsInBase: is sending > #decimalDigitLength , > implementing : > Integer>>#decimalDigitLength > ^self numberOfDigitsInBase: 10 > is possible but a little troubling (inverted send logic in superclass > and subclass). > Also, you'd better not remove SmallInteger>>#decimalDigitLength > because avoiding quo: it is very efficient for most common cases. > So maybe adding a third message numberOfDigits is the best way... I > let you judge by yourself. > (Bad luck, I just come back from Greece, and if you ask an oracle, > answer is rarely yes or no). > > Nicolas > > 2009/4/12 Stéphane Ducasse <[hidden email]>: >> may be there is a better solution.. Nicolas?? >> >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
I checked
http://squeakvm.org/unix/ and I could not understand where is the unix closure vm. stef On Apr 12, 2009, at 9:49 PM, Stéphane Ducasse wrote: > :) > > decimalDigitLength looks like an obscure name. > > Stef > > On Apr 12, 2009, at 5:32 PM, Nicolas Cellier wrote: > >> Just two remarks from a non native english guy: >> >> 1) "digit" is also used with different semantic in #digitLength >> #digitAt: #digitAt:put: >> and thus a method comment is more than welcome! > > yeap! > > >> >> >> 2) there is already a SmallInteger>>#decimalDigitLength doing what >> you want. >> However, since SmallInteger>>#numberOfDigitsInBase: is sending >> #decimalDigitLength , >> implementing : >> Integer>>#decimalDigitLength >> ^self numberOfDigitsInBase: 10 >> is possible but a little troubling (inverted send logic in superclass >> and subclass). >> Also, you'd better not remove SmallInteger>>#decimalDigitLength >> because avoiding quo: it is very efficient for most common cases. >> So maybe adding a third message numberOfDigits is the best way... I >> let you judge by yourself. >> (Bad luck, I just come back from Greece, and if you ask an oracle, >> answer is rarely yes or no). >> >> Nicolas >> >> 2009/4/12 Stéphane Ducasse <[hidden email]>: >>> may be there is a better solution.. Nicolas?? >>> >>> >>> >>> >>> _______________________________________________ >>> Pharo-project mailing list >>> [hidden email] >>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >>> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |