On Tue, 1 Apr 2003, Flavio S. Glock wrote:
> Dave Rolsky wrote:
> > Looking at this makes me think that instead, there should be multiple
> > methods, so we'd have:
> > DateTime::SpanSet->from_recurrences( recurrences => [ \&r1, \&r2 ] );
> > DateTime::SpanSet->from_sets( sets => [ \&s1, \&s2 ] );
>
> I think this doesn't make it clear that one set has "start-dates" and
> the other set has "end-dates", such as in:
>
> DateTime::SpanSet->from_sets( sets => [ $sunrise, $sunset ] );
Well, then it could be:
DateTime::SpanSet->from_sets( start => $s1, end => $s2 );
> - DateTime::Set constructors:
>
> from_dates ( dates => [ $dt1, $dt2, ... ] );
good. Except maybe it should be "from_datetimes", just to be consistent
with the module name.
>
> from_recurrence ( recurrence => sub { ... }, %span );
> # %span defines an optional span:
> # span => $span1
> # begin => $dt1, before => $dt2
I think the optional span should just be a DateTime::Span object for now.
Later, once we have a better idea how people are using these modules, we
can start creating shortcuts for some things.
> # current API:
> new ( dates => [ $dt1, $dt2, ... ] );
> new ( recurrence => sub { ... }, start => $dt1, end => $dt2 );
If we're going to offer the above constructors, then I think we should
remove the new() method.
> - DateTime::Span constructors:
>
> from_date_and_duration ( date => $dt1, %duration );
> # %duration defines a duration
> # duration => $dur1
> # days => 1
>
> # current API:
> new ( begin/after => $dt1, before/end => $dt2 );
If we get rid of new() then we'd need a "from_dates()" method, I guess,
which could take begin/after and before/end parameters.
> - DateTime::SpanSet constructors:
>
> from_spans ( spans => [ $span1, $span2 ] );
>
> from_set_and_duration ( set => $set1, %duration );
> # %duration defines a duration
> # duration => $dur1
> # days => 1
Sure
> from_sets ( start_set => $set1, end_set => $set2 );
I still want to know how this works! What if the earliest datetime in
$set2 is _earlier_ than the earliest datetime in $set1?
> from_recurrences ( start_recurrence => sub { ... }, end_recurrence =>
> sub { ... } );
Same question.
> # current API:
> new ( spans => [ $span1, $span2 ] );
This would go away too.
Do other people have opinions on this? It'd mean there'd be no new()
methods for these classes, and that might confuse people at first.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/