automake-patches
[Top][All Lists]
Advanced

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

Re: FYI: better diagnostics on `+=' misuses (HEAD)


From: Raja R Harinath
Subject: Re: FYI: better diagnostics on `+=' misuses (HEAD)
Date: Fri, 17 May 2002 14:42:45 -0500
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2.50 (i686-pc-linux-gnu)

Hi,

Alexandre Duret-Lutz <address@hidden> writes:
[snip]
> +# $BOOLEAN
> +# &conditional_implies_one_of ($COND, @CONDS)
> +# -------------------------------------------

Is 'conditional_implies_any' a better name?  The function actually
computes "implies at least one of".

> +# @MISSING_CONDS
> +# variable_not_always_defined_in_cond ($VAR, $COND)
> +# ---------------------------------------------

That's an awkward name.  

Also what about:

  if COND1
    A = foo
    if COND2
      D = bar
    else
      D = baz
    endif
  endif

Does it ever occur that you'll need to look at:

  variable_not_always_defined_in_cond ('A', 'COND1_TRUE COND2_TRUE');

Given the loop at the end of 'variable_conditions_sub', it may be
possible.

I think it would be better to have:

  variable_subconditions (var, cond)

For the above example

  variable_subconditions ('A', 'COND1_TRUE') => ('TRUE')
  variable_subconditions ('D', 'COND1_TRUE') => ('COND2_TRUE', 'COND2_FALSE')

I think you can invert the result of this function and prepend
COND1_TRUE to get the result of your function.

[snip]
>  sub invert_conditions
>  {
>      my (@conds) = @_;
>
>      my @notconds = ();
> -    foreach my $cond (@conds)
> +
> +    # Generate all permutation for all inputs.
> +    my @perm =
> +     map { variable_conditions_permutations (split(' ', $_)); } @conds;
> +    # Remove redundant conditions.
> +    @perm = variable_conditions_reduce @perm;
> +
> +    # Now remove all conditions which imply one of the input conditions.
> +    foreach my $perm (@perm)
>      {
> -     foreach my $perm (variable_conditions_permutations (split(' ', $cond)))
> -     {
> -         push @notconds, $perm
> -                 if ! conditional_is_redundant ($perm, @conds);
> -     }
> +     push @notconds, $perm
> +         if ! conditional_implies_one_of ($perm, @conds);
>      }
> -    return variable_conditions_reduce (@notconds);
> +    return @notconds;
>  }

Much better.

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



reply via email to

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