[squeak-dev] The Inbox: Chronology-Core-cbc.41.mcz

David T. Lewis lewis at mail.msen.com
Sun Apr 28 13:35:32 UTC 2019


The addition of #dayOfLocalWeek is a good addition. But I want ask
about the selector name and category. This isn't a criticism, more of
a question because I do not understand how is it used in practice.

We have #toggleStartMonday that changes start day to either #Monday or
#Sunday. This is an original brp method, but I don't know the reason
for it. And #dayOfWeek is listed in the 'ansi-protocol'. Is the start
day of week actually specified in the ANSI standard?

While I cannot think of any better selector name, I tend to think of
"local" as refering to local time offset from UTC, so dayOfLocalWeek
seems misleading in that sense. To me it seems more like dayOfLocalWeek
is a dayOfWeek that is corrected for the toggled startDay. So maybe
a name like correctedDayOfWeek or dayOfWeekCorrected might work? But
these do not seem satisfactory either, because they do not suggest
what is being corrected.

Suggestions welcome, and if nobody can think of a better idea then I
am +1 for moving this to trunk as it is.

Dave


On Mon, Apr 22, 2019 at 04:00:19PM +0000, commits at source.squeak.org wrote:
> Chris Cunningham uploaded a new version of Chronology-Core to project The Inbox:
> http://source.squeak.org/inbox/Chronology-Core-cbc.41.mcz
> 
> ==================== Summary ====================
> 
> Name: Chronology-Core-cbc.41
> Author: cbc
> Time: 22 April 2019, 8:58:13.835953 am
> UUID: 3d8013b6-d58f-004e-8e6b-5a59ed5841e7
> Ancestors: Chronology-Core-dtl.40
> 
> We have the ability to change the starting day of the week (Week>>startDay:).
> This change adds #dayOfLocalWeek to DateAndTime and Timespan to return the indexed day of the week based on the altered starting day.
> Original #dayOfWeek is left as-is along with all other working code.
> 
> =============== Diff against Chronology-Core-dtl.40 ===============
> 
> Item was added:
> + ----- Method: DateAndTime>>dayOfLocalWeek (in category 'ansi protocol') -----
> + dayOfLocalWeek
> + 
> + 	"Sunday=1, ... , Saturday=7"
> + 
> + 	^ (self julianDayNumber + 2 - Week weekdayStartIndex rem: 7) + 1
> + !
> 
> Item was added:
> + ----- Method: Timespan>>dayOfLocalWeek (in category 'ansi protocol') -----
> + dayOfLocalWeek
> + 	"Answer the day of the week represented by the receiver."
> + 
> + 	^ start dayOfLocalWeek!
> 
> Item was added:
> + ----- Method: Week class>>weekdayStartIndex (in category 'squeak protocol') -----
> + weekdayStartIndex
> + 	^self indexOfDay: self startDay!
> 
> 


More information about the Squeak-dev mailing list