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

David T. Lewis lewis at mail.msen.com
Mon Apr 29 02:09:51 UTC 2019


That would certainly be the sensible thing to do. However ...

The ANSI draft https://wiki.squeak.org/squeak/uploads/172/standard_v1_9-indexed.pdf
says the following on page 254:


5.8.1.9 Message: dayOfWeek
  Synopsis
    Answer the number of the day in the week, in the local time of the receiver, which
    includes the receiver.
  Definition: <DateAndTime>
    Answer an <integer> between 1 and 7 inclusive representing the number of the day
    in the week, in the local time of the receiver, which includes the receiver.
    Sunday is 1, Monday is 2, and so on. 

So this means that our #dayOfWeek method in the "ansi protocol" category
is compliant with the ANSI standard. And it means that Chris C's proposal
is correct in keeping that method intact and giving a new name to the
method that is more sensibe but different.

Dave


On Sun, Apr 28, 2019 at 06:01:40PM -0500, Chris Muller wrote:
> What about keeping the existing selector #dayOfWeek, and making it
> respect Week>>startDay?
> 
> 
> On Sun, Apr 28, 2019 at 8:35 AM David T. Lewis <lewis at mail.msen.com> wrote:
> >
> > 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