Dave Rolsky <[EMAIL PROTECTED]> wrote:

> On Wed, 5 Feb 2003, Rick Measham wrote:
>
>> I'd prefer the behavior of:
>> my $dt = DateTime->new( hour => 7, minute => 75);
>>
>> to be the equivalent of:
>> my $dt = DateTime->new( hour => 8, minute => 15);
>>
>> [...]
>
> Actually, this _is_ what it does now, but it's not documented,
> so that shouldn't be relied upon.  I'm not entirely sure that
> simply accepting _any_ number makes for a good API, however.  I
> suspect that in many cases, numbers outside the expected
> boundaries may indicate an error on the caller's part.

I think both behaviours ("normalization" and throwing an error)
are useful, so how about adding options to the constructor, so one
can use

   my $dt = DateTime->new( VALIDATE = 0,
                           hour => 7,
                           minute => 75,
                         );

to enable/disable validation of arguments.  

I'm sorry if this has been discussed before (and rejected).

Peter

-- 
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;

Reply via email to