---------- Forwarded message ----------
Date: Tue, 17 Jun 2003 07:55:57 -0400
From: Ben Bennett <[EMAIL PROTECTED]>
To: Joshua Hoblitt <[EMAIL PROTECTED]>
Subject: Re: [announce] DateTime::TimeZone::Alias 0.01

On Mon, Jun 16, 2003 at 08:38:31PM -1000, Joshua Hoblitt wrote:
>
>     my $aliased_tz = DateTime::TimeZone::Alias->value( 'EST' );

Looks reasonable.

> > This is specifically why I made the is_N functions public.
> >
> >     if ( ! DateTime::TimeZone::Alias->is_defined( 'EST' ) ) {
> >         DateTime::TimeZone::Alias->add( EST => 'US/Eastern' );
> >     }

That isn't quite the same thing.  The code I had in mind would need to
do:
--
my $dta = "DateTime::TimeZone::Alias";
if ( not $dta->is_defined( "EST" ) ) {
    $dta->add( EST => "US/Eastern" );
}
elsif ( ( $dta->is_alias("US/Eastern") and
          $dta->value( "EST" ) eq $dta->value( "US/Eastern" )
         ) or
         $dta->value( "EST" ) eq "US/Eastern"
       )
{
    croak "Redefining timezone";
}
--

Which is a bit of a pain.

>
> I really dislike functions that accept an argument then quietly do nothing.  Code 
> should "Say what you mean."

Ah, but it is doing what the user meant... it would only do nothing if
the value it was about to alias was the same.  Otherwise it would
throw a screaming hissy fit (or an error :-).

                  -ben

Reply via email to