On Tue, 2 Mar 2004 [EMAIL PROTECTED] wrote:

> > On Mon, 1 Mar 2004, Flavio S. Glock wrote:
> >
> > > How about this API (almost the same as
> > > Date::Set's):
> > >
> > >    my $start_set =
> > >        $spanset->iterate(
> > >            sub { $_[0]->start }
> > >        );
> > >    my $end_set =
> > >        $spanset->iterate(
> > >            sub { $_[0]->end }
> > >        );
> > >
> > > note: $_[0] is a DateTime::Span.
> >
> > Looks good.  I think it'd be good to change
> > DateTime::Set so that it's iterate() method
> > _returned_ a set instead of modifying the set
> > the method is called on, though.
> >
> > Otherwise we'd have two methods with the same
> > name that did different things.
> >
>
> Actually, it should read:
>
>     my $start_set =
>         $spanset->clone->iterate(
>             sub { $_[0]->start }
>         );
>     my $end_set =
>         $spanset->clone->iterate(
>             sub { $_[0]->end }
>         );
>
> But there is a problem - iterate()  would return a spanset, and then we
> would need a method that converted the result to a datetime::set.
>
> So we'd better have start_set/end_set methods, anyway.

Aren't sets, spans, and spansets all the same thing internally, anyway?
Why not just offer an explicit to_set method for DateTime::SpanSet, that
"does the right thing" (whatever that may be ;)


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to