[squeak-dev] The Inbox: Chronology-Core-ul.22.mcz
Levente Uzonyi
leves at caesar.elte.hu
Tue Jan 15 21:42:42 UTC 2019
Hi Eliot,
On Mon, 14 Jan 2019, Eliot Miranda wrote:
> Hi Levente,
>
>> = aDateAndTimeOrTimeStamp
>> "Equal if the absolute time values match, regardless of local time transform"
>> +
>> self == aDateAndTimeOrTimeStamp ifTrue: [ ^ true ].
>> + aDateAndTimeOrTimeStamp species == DateAndTime ifFalse: [ ^false ].
>> + aDateAndTimeOrTimeStamp utcMicroseconds = utcMicroseconds ifTrue: [ ^true ].
>> + ^false!
>> - ^aDateAndTimeOrTimeStamp species == DateAndTime
>> - and: [ utcMicroseconds = aDateAndTimeOrTimeStamp utcMicroseconds ]!
>
> Can we please avoid the ... ifFalse: [^false] style and keep the much nicer concise and: style? Yes, the former is slightly faster, but not by much, and the JIT has code to minimize the difference and Sista will eliminate the difference. The former style is so ugly.
I personally prefer early returns because I find them much more readable:
for every boolean term I can tell exactly how it will affect the return
value of the method, while that is a lot harder with a single boolean
expression.
I agree that the last two returns could be simplified into a single
return but I see no problem with the rest.
Levente
More information about the Squeak-dev
mailing list
|