[Rpm-ecosystem] Rich deps syntax finalization

Michael Schroeder mls at suse.de
Mon Aug 31 09:33:44 UTC 2015


On Sun, Aug 30, 2015 at 04:43:56PM +1000, Nick Coghlan wrote:
> 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.

The main reason I prefer (A IF COND ELSE B) over (COND ? A : B) is that
the most common case will be the "if" without the "else" clause , and
the C language doesn't provide this. (A IF COND) still is very readable,
but (COND ? A) is pretty obfuscated.

Cheers,
  Michael.

-- 
Michael Schroeder                                   mls at suse.de
SUSE LINUX GmbH,           GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}


More information about the Rpm-ecosystem mailing list