On Tue, 14 Jan 2003, Nick Tonkin wrote:

> My preference is to keep integers out of variable names. It's easier to
> read.
>
> What about $date->month_zero_indexed ?

Maybe.

> Also: What about my suggestion that a switch in the DateTime constructor
> cause the default methods to become zero-indexed? Then the names would be
> just used internally anyway.
>
> my $dt = DateTime->new;
> $month = $dt->month(1); # January
>
> my $dt = DateTime->new(zero_indexing => 'yep');
> $month = $dt->month(1); # February, because internal magic overloads
>                         # month() with month_zero_indexed

No, cause then nobody will ever be able to _learn_ the DateTime API,
because the return value of the methods will be conditional on them
knowing how the object was constructed.  That would be very, very bad.
With my way, if it says "month" or "month_0" and you know the API, you
know what is being returned.


-dave

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

Reply via email to