[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: Re: [gentoo-dev] new eclass: tmpfiles.eclass round 4
From: Mike Gilbert <floppym () gentoo ! org>
Date: 2016-11-30 12:35:49
Message-ID: CAJ0EP409ak2=zuckKGVRM8XtpMw++i6L1Pv=0qooLSxi1cfOMw () mail ! gmail ! com
[Download RAW message or body]
On Wed, Nov 30, 2016 at 7:11 AM, konsolebox <konsolebox@gmail.com> wrote:
>>> I also prefer some things this way:
>>>
>>> - Indent the contents of the first `if` block for consistency's sake,
>>> and less confusion.
>>
>> I disagree; indenting the entire eclass is silly and does not really
>> improve readability. Also, this is a very common pattern found in
>> other eclasses.
>
> I prefer following consistency before anything else. And it's just
> uncommon and odd, but it's not silly. Imagine if you use another `if`
> block on the second level where more functions are defined. Would you
> also not indent that?
That first "if" is a bit of a special case; it's only there to prevent
the code from being executed more than once in global scope. This
provides a minor speed boost when the eclass gets sourced more than
once, and makes sure that any global variables are only set once.
I think of it as being similar to pre-processor statement you would
find in a C header file; one does not generally indent all the code
within a C header file, because it just introduces a big chunk of
whitespace that does not improve code readability.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic