[Rpm-ecosystem] Rich deps syntax finalization
ffesti at redhat.com
Wed Aug 26 08:29:56 UTC 2015
On 08/25/2015 06:12 PM, Pavel Odvody wrote:
> On Tue, 2015-08-25 at 18:01 +0200, Florian Festi wrote:
>> On 08/25/2015 05:54 PM, Pavel Odvody wrote:
>>>> Technically a NOT operator should not be needed. So we are basically
>>>> looking for real life examples where it would be really handy or even a
>>>> pain if it was missing. What would you do with a NOT operator?
>>> Requires: (PkgA AND (PkgB IF NOT PkgC)
>>> But I'm really not sure whether it isn't just easier (correct) to handle
>>> this through conflicts / virtual provide.
>> Well, as Requires are (logically) all connected with an AND this is
>> equivalent to:
>> Requires: PkgA
>> Requires: (PkgB IF NOT PkgC)
>> And as IF is equivalent to OR NOT this is equivalent to
>> Requires: PkgA
>> Requires: (PkgB OR PkgC)
> This is a great remark - Arguments are short-circuit evaluated.
Short-circuit evaluation is a concept that has no meaning here. But you
are in good company if you are confused about it. Michael and I
discussed a Perl style UNLESS operator for 20 minutes until we realized
that it does make sense .
Short-circuit evaluation means some sub expressions are not looked at at
all. But this is only relevant if evaluating some expressions can have
side effects. As the matching does not have side effects you cannot tell
from outside whether the implementation uses short circuit evaluation or
not. So it is an implementation detail that's not your business.
 Perl6 style UNLESS operator is a IF NOT. It is "needed" in perl
because it is short circuit with inverse evaluation order. So the
expression behind the "unless" is evaluated first and if it is FALSE the
expression in front is evaluated. After a while we realized that as IF
is just OR NOT UNLESS is just OR as the two NOT cancle each other out.
As we Boolean values without side effects there is no point on such an
operator in RPM.
Red Hat GmbH, http://www.de.redhat.com/ Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael Cunningham, Michael
O'Neill, Charles Peters
More information about the Rpm-ecosystem