I like the idea (this is the partial date & time thing right?) but I
am not too sure about the name... unless you start dealing with times
with real and imaginary parts :-) (Not that I have any suggestions for
a name yet).

Regarding the interface would it be better to have:
--
  my $dtc1 = DateTime::Complex->new_undef();
  # I assume that DT::C->new() assumes 0 like DT->new()
  # but that DT::C->new(year => 2003, day => undef )
  # would give 2003-xx-01-T00:00:00?

  my $dtc2 = $dtc1->set( month => 12 );
  my $christmas = $dtc2->set( day => 24 );
   # Do these clone BTW or are $dtc1, $dtc2 and $christmas all refs
   # to the same object (like DateTime does)?

  my $december = $christmas->set(day => undef);

  print $december->datetime;
  # xxxx-12-xxTxx:xx:xx

  # See above question re cloning objects.
  print $christmas->next( DateTime->now )->datetime;
  # 2003-12-24Txx:xx:xx

  my $xmas_noon = $christmas->clone()->set( hour => 12 );

  print $christmas->contains( $xmas_noon );
  # 1
--

Regarding the cloning question, it is more like DateTime if they do
not get cloned autmomatically, but I am assuming your implementation
is based on your DT::Set which I think does clone automatically?  I
would still vote for not cloning.

                -ben

On Fri, Jul 18, 2003 at 11:15:30AM -0300, Flavio S. Glock wrote:
> RFC: DateTime::Complex
> 
>   use DateTime;
>   use DateTime::Complex;
>   use strict;
> 
>   my $dtc1 = DateTime::Complex->new_undef;
> 
>   my $dtc2 = $dtc1->define_month( 12 );
>   my $christmas = $dtc2->define_day( 24 );
> 
>   my $december = $christmas->undef_day;
> 
>   print $december->datetime;
>   # xxxx-12-xxTxx:xx:xx
> 
>   print $christmas->next( DateTime->now )->datetime;
>   # 2003-12-24Txx:xx:xx
> 
>   my $xmas_noon = $christmas->define_hour( 12 );
> 
>   print $christmas->contains( $xmas_noon );
>   # 1
> 
>   [some too-weird examples removed]
> 
> :)
> - Flavio S. Glock

Reply via email to