On Wed, Nov 30, 2016 at 7:11 AM, konsolebox <konsole...@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.