On 26 August 2015 at 20:13, Vít Ondruch <vondr...@redhat.com> wrote:
> Dne 25.8.2015 v 17:16 Florian Festi napsal(a):
>> On 08/25/2015 02:50 PM, Vít Ondruch wrote:
>>> I read it as "install foo-lang-es in case langsupport-es is
>>> installed". This is quite common construct, but I really don't
>>> understand the else case.
>>> Could you please read it for me? Especially the ternary operator
>>> version, it looks like ternary operator but I am afraid it is not.
>>
>> Requires: (foo-lang-es if langsupport-es else foo-lang-generic)
>> Requires: (langsupport-es ? foo-lang-es : foo-lang-generic)
>>
>> These two variants are equivalent. Only the first two operands have
>> switched places in both the binary and the ternary version.
>
> The swapped order worries me. I have yet to see any language which
> supports the "[else .]" part of if condition in the backward order.

The two main options being considered are essentially "Python-style"
or "C-style":

Python: (true_result if condition else false_result)
C: (condition ? true_result : false_result)

The key for me is that given the text:

    Requires: (foo-lang-es IF langsupport-es ELSE foo-lang-generic)

any developer that can read both English and RPM spec files is likely
to be able to hazard a good guess as to what that will do, as it's an
abbreviation of the sentence "This package Requires foo-lang-es IF
langsupport-es is provided, ELSE it requires foo-lang-generic". Even
if a developer does need it explained to them the first time they see
it, the sentence form is still useful as a mnemonic.

By contrast, the only way to know what "Requires: (langsupport-es ?
foo-lang-es : foo-lang-generic)" means is to be a C developer, or to
know one of the languages that borrowed that syntax from C - it isn't
possible to reason it out just by knowing English.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem

Reply via email to