[squeak-dev] The Inbox: Kernel-ul.1411.mcz
Tobias Pape
Das.Linux at gmx.de
Fri Sep 10 16:17:44 UTC 2021
Hi
> On 10. Sep 2021, at 17:41, Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
>
> Hi Tobias --
>
> > Please don't deprecate stuff unnecessarily :)
>
> Why do you think that #strictlyPositive is necessary?
Practically, it avoids parenthesis.
But it also allows an "abstract" thinking.
You can talk about a property of a thing without the need of a comparison.
"As long as we have a strictly positive balance, this project can continue"
vs
"As long as we have a balance that is greater than zero, this project can continue"
Here it's an attribute of the balance and not a relation to a number…
> Well, we can at least leave it as a convenience method. I was just curious why we would not want to use it in SmallInteger. I suspected performance ...
True…
Best regards
-Tobias
>
> Best,
> Marcel
>> Am 10.09.2021 17:11:12 schrieb Tobias Pape <das.linux at gmx.de>:
>>
>>
>>
>> > On 10. Sep 2021, at 16:05, Marcel Taeumel wrote:
>> >
>> > Hi Levente --
>> >
>> > > removed Integer >> #isPowerOfTwo because it was not used: all subclasses implement that method
>> >
>> > Hmm... what about removing the one in SmallInteger instead bc. its implementation is not that special. #strictlyPositive might be deprecated as well, looking at its 4 senders. Maybe just replace those few integer uses with "> 0" instead.
>> >
>> I like strictlyPositive. Not just because it's a unary message.
>> Please don't deprecate stuff unnecessarily :)
>>
>> Best regards
>> -Tobias
>>
>> > Best,
>> > Marcel
>> >> Am 10.09.2021 15:56:05 schrieb commits at source.squeak.org :
>> >>
>> >> Levente Uzonyi uploaded a new version of Kernel to project The Inbox:
>> >> http://source.squeak.org/inbox/Kernel-ul.1411.mcz
>> >>
>> >> ==================== Summary ====================
>> >>
>> >> Name: Kernel-ul.1411
>> >> Author: ul
>> >> Time: 10 September 2021, 3:16:23.23175 pm
>> >> UUID: 9d7f74f9-52b9-4a1c-babf-60de439244bb
>> >> Ancestors: Kernel-ul.1409
>> >>
>> >> - let all Numbers respond to #isPowerOfTwo.
>> >> - removed Integer >> #isPowerOfTwo because it was not used: all subclasses implement that method
>> >>
>> >> =============== Diff against Kernel-ul.1409 ===============
>> >>
>> >> Item was added:
>> >> + ----- Method: Fraction>>isPowerOfTwo (in category 'testing') -----
>> >> + isPowerOfTwo
>> >> + "Return true if the receiver is an integral power of two."
>> >> +
>> >> + ^numerator = 1 and: [ denominator isPowerOfTwo ]!
>> >>
>> >> Item was removed:
>> >> - ----- Method: Integer>>isPowerOfTwo (in category 'testing') -----
>> >> - isPowerOfTwo
>> >> - "Return true if the receiver is an integral power of two."
>> >> -
>> >> - ^self strictlyPositive and: [ (self bitAnd: self - 1) = 0 ]!
>> >>
>> >> Item was added:
>> >> + ----- Method: Number>>isPowerOfTwo (in category 'testing') -----
>> >> + isPowerOfTwo
>> >> + "Return true if the receiver is an integral power of two."
>> >> +
>> >> + self subclassResponsibility!
>> >>
>> >> Item was added:
>> >> + ----- Method: ScaledDecimal>>isPowerOfTwo (in category 'testing') -----
>> >> + isPowerOfTwo
>> >> + "Return true if the receiver is an integral power of two."
>> >> +
>> >> + ^fraction isPowerOfTwo!
>> >>
>> >>
>> >
>>
>>
>>
>
More information about the Squeak-dev
mailing list
|