On Wed, 11 Jun 2003, Joshua Hoblitt wrote:

> > > DateTime::Wrapper::SubSecond will accept parameters for resolutions from
> > > 10 to 10^9 subseconds.  With corresponding methods returning these
> > > units.
> > This seems like overkill for something which will basically do:
> >
> >  my $nano = $p{micro} * 1000;
>
> Which is why I wanted to put it in the core.  This seems to be a
> circular argument. :)

The problem with making it a constructor option is that if a user passes
nanosecond _and_ micro/milli parameters, it's confusing.  It's bad enough
that fractional_second and nanosecond are overlapping, and in a really
weird way now that I look more closely!

Ugh, the fractional_second parameter must go.  The docs for it are all
wrong, and what it's actually doing is _really_ odd.

Anyway, I _really_ don't like having mututally exclusive, but overlapping,
constructor parameters.  This makes for hard-to-read docs.  Ideally, each
parameter is unique, and falls into the category of required, "has
default", or optional.

I said a _wrapper_ was overkill because you could just as easily write
something like:

 micro_as_nano { $_[0] * 1000 }
 milli_as_nano { $_[0] * 1000000 }

and then do:

 DateTime->new( ..., nanosecond => milli_as_nano(500) )

Isn't that simpler?  Is there any need to wrap all the DateTime
constructors?  No, obviously not.  It's two one-liner exported functions
that are mere syntactic sugar!


-dave

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

Reply via email to