automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: ConditionalSet.pm


From: Raja R Harinath
Subject: Re: FYI: ConditionalSet.pm
Date: Thu, 14 Nov 2002 19:43:38 -0600
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Hi,

Here's some I missed the last time.

Alexandre Duret-Lutz <address@hidden> writes:
[snip]
> Index: lib/Automake/ConditionalSet.pm
> ===================================================================
[snip]
> +sub invert($ )
> +{
> +  my ($self) = @_;
> +
> +  return $self->{'invert'} if defined $self->{'invert'};
> +
> +  # Generate permutations for all subconditions.
> +  my @perm = $self->permutations->conds;
> +  # Remove redundant conditions.
> +  @perm = Automake::Conditional::reduce @perm;
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By construction, there should be nothing redundant generated by
'permutations'.  So, this just a very expensive no-op.  You should
probably remove it.

> +  # Now remove all conditions which imply one of the input conditions.
> +  my @conds = $self->conds;
> +  my @notconds = ();
> +  foreach my $perm (@perm)
> +    {
> +      push @notconds, $perm
> +     if ! $perm->implies_any (@conds);
> +    }

One-liner :-)

  my @notconds = grep { ! $_->implies_any (@conds) } $self->permutation->conds;

> +  my $res = new Automake::ConditionalSet @notconds;
> +
> +  # Cache result.
> +  $self->{'invert'} = $res;
> +  # It's tempting to also set $res->{'invert'} to $self, but that
> +  # isn't a bad idea as $self hasn't been normalized in any way.
       ^^^^^

ITYM 'is'.

- Hari
-- 
Raja R Harinath ------------------------------ address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]