Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I'd probably be willing to put set_day_of_week into DateTime.pm proper. I don't know about the sugar methods though.

    Regardless, DateTime::Weekdays probably isn't the right namespace. Please come discuss this on the datetime@perl.org list.
    • I know this is not the proper venue – I saw the pointer to the mailing list. I posted here instead of to the list because, well, I’d have to subscribe to the list, and then I’d be subscribed to yet another Perl list. I am on way too many of those already… I guess I should consolidate the mailboxes for the low-traffic lists and suck it up.

      Also, I know it’s not a good name. Don’t worry, I’m not putting this on CPAN quite yet. :-) That’s why I posted an RFC.

      I

      • I think set_day_of_week is a bad name and doesn't belong in the core of DateTime. The name doesn't really uniquely identify what the method does and implies several different inconsistent possibilities for its semantics.

        I think it'd be better if this functionality were wrapped in a DateTime::Set, which would give you the next and previous methods you are looking for. Maybe DateTime::Set::ByWeekday?

        --
        J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
        • That sounds reasonable; I’m just not sure it makes sense. There is nothing of interest about the set as a whole: it’s no more than a set with weekly recurrence (and you can easily construct it that way if you do need such a set). The only property of interest is that 2 (or 3) specific members of the set are closest to a particular date.

          Also, I wanted to roll in a way to find the passed weekday that falls within the same week as the given date. To me there seems to be no reasonable way to conceive of that as a set.

          I suppose you could make an argument that it is a set of just 2–3 datetimes (the weekday within the same week, the strictly previous and strictly next weekdays, and the day itself, where the last may not be part of the set and the first always coincides with one of the others). That, I suppose, would be more an issue of naming. But it doesn’t really make any sense to iterate over that kind of set.