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!
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@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!
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@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@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!
Hi Chris,
I though of that. The number of methods that derive off of dayOfWeek is significant in Week; I'm not sure where outside of Week it is used as well.
Methods to change Week class #indexOfDay: #nameOfDay: #starting:duration: Week instance
On Sun, Apr 28, 2019 at 4:02 PM Chris Muller asqueaker@gmail.com 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@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@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!
whoops
On Sun, Apr 28, 2019 at 5:17 PM Chris Cunningham cunningham.cb@gmail.com wrote:
Hi Chris,
I though of that. The number of methods that derive off of dayOfWeek is significant in Week; I'm not sure where outside of Week it is used as well.
Methods to change Week class #indexOfDay: #nameOfDay: #starting:duration: Week instance
#index
Maybe it is desirable to make a nearly complete overhaul, but I instead opted for minimum viable change.
That said, the only class that uses alternate Week starting days in MonthMorph, which does seem to work as-is (but CalendarMorph doesn't pay any attention to alternate months).
There is a bug in MonthMorph - if you try to bring up the menu on the title of the morph, it errors out (related to Week startDays - it thinks this should be a boolean even thought it sets it as a symbol elsewhere). More to fix, guess.
WeekMorph seems to only accept Sunday and Monday starts (which is a basis for MonthMorph, which also only support Sunday/Monday starts).
That is mostly it for classes in the base image.
It would be nice to support correct weeks (which y'all seem to be in agreement with). The best map of where different weeks start I found was at: http://chartsbin.com/view/41671 . (Although there are several comments, here and elsewhere, that the actual countries listed are wrong - and several countries they have not data for.)
I could have sworn that there was at least one country that also started their week on Friday, but I can't find any evidence of that online. Maybe I'll be able to track down the person that told me that - but I likely just heard him wrong.
Thanks, cbc
On Sun, Apr 28, 2019 at 4:02 PM Chris Muller asqueaker@gmail.com 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@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@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!
I see. it would mess up the ability to set a different #startDay, because some of them are depending on the assumption that Sunday is 1, for example, DateAndTime>>#dayOfWeekName.
It could be useful if those places that depend on that assumption made it explicit. Like:
dayOfWeekName ^ Week nameOfDay: (self dayOfWeekFrom: #Sunday)
The ones that aren't depending on that assumption could be left at #dayOfWeek.
Another option would be to go the other way. Require the places that want Other-Than-Sunday to specify that extra argument, and it maybe it will usually be "Week startDay", but it's a heads-up to future reader.
Dave's recent updates took Chronology up a notch. It's pretty clean and pretty fast. If we know we're going to be +1 selector in the system, it could be #dayOfWeekFrom: instead of "localWeek" (just my taste, no offense intended :) ).
- Chris
On Sun, Apr 28, 2019 at 7:18 PM Chris Cunningham cunningham.cb@gmail.com wrote:
Hi Chris,
I though of that. The number of methods that derive off of dayOfWeek is significant in Week; I'm not sure where outside of Week it is used as well.
Methods to change Week class #indexOfDay: #nameOfDay: #starting:duration: Week instance
On Sun, Apr 28, 2019 at 4:02 PM Chris Muller asqueaker@gmail.com 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@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@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!
I think that Chronology-Core-cbc.41 should go to trunk without modification. I'll wait a day or so in case any further discussion pops up.
Nicolas has some parallel updates for real time clock support, and I assume these should go to trunk also. We can merge these when moving the Chronology-Core-nice.42 updates to trunk.
Dave
On Sun, Apr 28, 2019 at 09:45:13PM -0500, Chris Muller wrote:
I see. it would mess up the ability to set a different #startDay, because some of them are depending on the assumption that Sunday is 1, for example, DateAndTime>>#dayOfWeekName.
It could be useful if those places that depend on that assumption made it explicit. Like:
dayOfWeekName ^ Week nameOfDay: (self dayOfWeekFrom: #Sunday)
The ones that aren't depending on that assumption could be left at #dayOfWeek.
Another option would be to go the other way. Require the places that want Other-Than-Sunday to specify that extra argument, and it maybe it will usually be "Week startDay", but it's a heads-up to future reader.
Dave's recent updates took Chronology up a notch. It's pretty clean and pretty fast. If we know we're going to be +1 selector in the system, it could be #dayOfWeekFrom: instead of "localWeek" (just my taste, no offense intended :) ).
- Chris
On Sun, Apr 28, 2019 at 7:18 PM Chris Cunningham cunningham.cb@gmail.com wrote:
Hi Chris,
I though of that. The number of methods that derive off of dayOfWeek is significant in Week; I'm not sure where outside of Week it is used as well.
Methods to change Week class #indexOfDay: #nameOfDay: #starting:duration: Week instance
On Sun, Apr 28, 2019 at 4:02 PM Chris Muller asqueaker@gmail.com 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@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@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!
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@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@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!
squeak-dev@lists.squeakfoundation.org