svn commit: r329504 - head/stand/lua

Kyle Evans kevans at freebsd.org
Sun Feb 18 03:04:06 UTC 2018


On Sat, Feb 17, 2018 at 8:53 PM, Conrad Meyer <cem at freebsd.org> wrote:
> On Sat, Feb 17, 2018 at 5:35 PM, Kyle Evans <kevans at freebsd.org> wrote:
>> Author: kevans
>> Date: Sun Feb 18 01:35:46 2018
>> New Revision: 329504
>> URL: https://svnweb.freebsd.org/changeset/base/329504
>>
>> Log:
>>   stand/lua: More style nits, config.lua
>>
>>   Some other points I think we need to be consistent on:
>>   - Spacing around string concatenation (always)
>
> +1.  ".." is just another (infix) operator, and we put spaces around operators.
>
>>   - Test against 'nil' explicitly rather than relying on 'not' for things that
>>     reasonably won't be returning a boolean. e.g. loader.getenv
>>
>>   Eventually this will all get formalized somewhere.
>
> +1.  Ideally sooner rather than later.  Maybe a luastyle.9? :-)
>
> One thing we've done so far I'm not sold on is parentheses around
> conditionals.  Unlike C, this is not a language requirement, and it
> isn't common in other lua codebases, e.g.,
> https://github.com/luarocks/lua-style-guide .  (Take that guide with a
> grain of salt — it suggests treating nil as boolean false, which I
> agree is probably wrong.)

I'm definitely not stuck on the idea of parentheses around
conditionals, but it was inconsistently done before and I wanted to
make some effort to move one way or the other. I started learning lua
here [1] and therefore hold no strong position or prior knowledge, so
if no-parentheses is the Lua way then I'm all aboard. =)

[1] https://svnweb.freebsd.org/base?view=revision&revision=329274


More information about the svn-src-head mailing list