246145 (1) [Avatar] Offline
#1
On 3.2.2, the last bullet point of the implementation's features reads:

A typical invocation of the smart constructor could be DayOfWeek.dayOfWeek(n).map(schedule), where schedule is a function that schedules a job on the DayOfWeek that it gets as input


If the function actually schedules a job, the method used should be foreach, since it just performs a side effect. A map would transform a Option[DayOfWeek] into a Option[ScheduleJob] type, which I guess it's not what's intended.
Of course you can use map to perform a side effect but it's misleading. So IMHO it should be:

DayOfWeek.dayOfWeek(n).foreach(schedule)
Debasish Ghosh (116) [Avatar] Offline
#2
Hmm .. Though schedulers like Quartz offer a schedule API that returns the earliest time when the job will be scheduled to run, I think you are correct that "schedule" is basically a side-effecting function. I will change the "map" to "foreach". It may not make to the next MEAP though (the version for which have already been uploaded), but will in a future one. I will create an issue in Github and take care of it.

Thanks for the good observation.