On Fri, 2008-04-25 at 03:45 -0700, James Keenan via RT wrote:
> > Other than having a Darwin case, how is it different than the pattern?
> The Darwin case is the difference.
Ah.
> > my $platform = $os =~ /mswin32/i && $cc =~ /^gcc/i ? 'win32_gcc' :
> > $os =~ /mswin32/i ? 'win32_other' :
> > $os =~ /darwin/i ? 'darwin' :
> > ? 'default' ;
> >
> > my $libs = $args->{$platform} || $args->{default};
>
> Does this not imply that in the 4 classes addressed in the patch, the
> user of this method would be required to supply a 'darwin' key-value
> pair even though that the value for that key would be identical with
> 'non_win32' (or 'default')?
No. That's why the default key is called 'default', and why $libs is
set that way.
(Subtle note -- the || really wants to be //, but as I recall we're not
allowed to assume that // is there yet.)
> $self->_add_to_libs( {
> conf => $conf,
> osname => $osname,
> cc => $cc,
> win32_gcc => '-lreadline',
> win32_other => 'readline.lib',
> darwin => '-lreadline',
> default => '-lreadline',
> } );
As I mentioned to Infinoid on IRC, I designed a real default case so
that any key can be missing, and it will just fall back to the default.
So in your example above, both the 'darwin' and 'win32_gcc' cases could
just be dropped.
> Do you think that the added generality of what is essentially an
> internal helper method would then offset the additional complexity in
> that method's interface?
Not more complex. Simpler. :-)
-'f